[LLVMdev] accessing a bitcode library exported from C++ using the JIT
Eli Friedman
eli.friedman at gmail.com
Mon Aug 31 17:36:10 PDT 2009
On Tue, Sep 1, 2009 at 4:53 AM, Samuel Crow<samuraileumas at yahoo.com> wrote:
> We're using the LLVM Value * class functions to box and unbox values and functions for our stack. The stack needs to be able to take indexing without changing the stack pointer so we're using a std::vector for that. The std::string section would be a lot easier to replace than the two I just mentioned since we store the length separately.
If you really want to stick with std::string and std::vector, I'd
suggest just writing some wrappers for the relevant functions. For
example:
extern "C" char* String_cstr(std::string*);
extern "C" void Stack_pushback(std::vector*, void* value);
You can even compile these to bitcode with llvm-g++ and inline them
into your other IR.
I don't think compiling libstdc++ to bitcode actually helps you here;
you can call the relevant functions in libstdc++ whether or not
they're bitcode.
-Eli
More information about the llvm-dev
mailing list