[llvm-dev] JIT compilation with LLVM

Frank Tetzel via llvm-dev llvm-dev at lists.llvm.org
Mon May 13 02:05:36 PDT 2019

> I am developing a small project using LLVM. The objective is to
> provide dynamic loading via JIT compilation of C++ code contained in
> a (TS) module. For this reason, I would like to return an explicitly
> raw void pointer (resembling libdl's `void *dlsym(void *, char const
> *);` as closely as possible) to the compiled result. The MCJIT class
> offers the most convenient API for me, but I'm not sure it is
> intended for public use as it is not in the include path in a LLVM
> installation, even when built from source (I am building from the git
> repo); neither is OrcMCJITReplacement. What is the way that you would
> suggest to use LLVM's JIT capabilities? It would already help a lot
> if I knew which function/class names to look up.

I guess, the best place to start is the tutorial[1]. This one is for
the ORC JIT API. I am not the right person to ask what the prefered API
for new projects is as I'm still quite new to all of this as well.

To get a function pointer, you have to resolve the symbol in the
generated code.

[1] https://llvm.org/docs/tutorial/BuildingAJIT1.html

More information about the llvm-dev mailing list