samuraileumas at yahoo.com
2009-May-05 19:06 UTC
[LLVMdev] 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
On May 5, 2009, at 12:06 PM, samuraileumas at yahoo.com wrote:> Does the name-mangling scheme of LLVM-GCC affect global functions in > my libraryYes.> 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.
Maybe Matching Threads
- [LLVMdev] accessing a bitcode library exported from C++ using the JIT
- [LLVMdev] accessing a bitcode library exported from C++ using the JIT
- [LLVMdev] accessing a bitcode library exported from C++ using the JIT
- [LLVMdev] accessing a bitcode library exported from C++ using the JIT
- [LLVMdev] Circular Deps from CMake build using makefile