Calling C++ from LLVM Asm via JIT

Hello,

I'm helping to write a parser generator that uses LLVM bitcode as its destination type. Unlike most parser generators, it's written in C++ and is interpreted. The "actions" defined in it are to be written in LLVM Assembly.

In order to support symbol table lookups, there is a function call to a C++ library, saved as bitcode and loaded to a module at startup, that must be JITed while the parser generator parses. The signature of all of these immediately executed actions is a boolean output indicating whether the lookup failed or not. All other information handled by the subroutine is done via a global stack defined in the startup code.

Does the name-mangling scheme of LLVM-GCC affect global functions in my library and can they be called without a C binding? If not, how hard is it to write a C binding for a C++ function?

--Samuel Crow

Does the name-mangling scheme of LLVM-GCC affect global functions in my library

Yes.

and can they be called without a C binding?

Yes, if you want to write non-portable code.

If not, how hard is it to write a C binding for a C++ function?

One line per function. If you know python, awk or perl, you can even generating the bindings, if you had to.