[LLVMdev] Throwing C++ exception through LLVM JITed code

Duncan Sands baldrick at free.fr
Tue Oct 26 23:40:30 PDT 2010


Hi Chris,

> I am using LLVM to compile script code and then executing using the JIT compiler
> via the runFunction() method. The script code is contained with a C++ program
> compiled with G++. I am having a problem when an intrinsic function (i.e. a
> function implemented in C++ which is called from the LLVM compiled script)
> throws a C++ exception. I want the exception to be caught by the C++ code that
> invoked the script. Instead it appears that no exception handler is found.
>
> Does anyone know of a way to throw C++ exceptions through LLVM JITed code?

you have to explicitly turn on JIT support for exception handling.  For example
with the lli tool you can say that you want this by passing the -jit-enable-eh
flag on the command line.

Ciao,

Duncan.



More information about the llvm-dev mailing list