<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - The "HowToUseJit" example program seg faults"
   href="https://bugs.llvm.org/show_bug.cgi?id=38261">38261</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>The "HowToUseJit" example program seg faults
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Documentation
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>6.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows NT
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>General docs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>shivanshu3@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I compiled LLVM 6.0.0 on Windows for x64 as a DLL, and tried running the
"HowToUseJit" example program, and it seg faulted.

I had to make the following 2 modifications to make the example functional:

Add the following include:
#include "llvm/ExecutionEngine/MCJIT.h"

I also added a call to this function inside main:
LLVMInitializeNativeAsmPrinter();

The example should be updated with these 2 fixes.

As a side note, I also compiled LLVM as a static lib, and when I linked my
program against that static lib, I didn't need to #include MCJIT.h. So it
didn't segfault in that case. But I still had to add a call to the function
"LLVMInitializeNativeAsmPrinter" in order to make the example work.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>