[LLVMdev] calling member via JIT

Stefan Weigert weigert.stefan at googlemail.com
Wed Jul 29 01:23:51 PDT 2009


new day, new luck ;)

after some semi-educated tries, it is working now.
1. it had nothing to do with the external super-class itsself but exclusively 
with the fact, that i loaded the external lib via llvm::DynamicLibrary before 
jitting
2. then, if i use c++ functionality, like std::cout, it segfaults
3. it does not segfault when using puts from <cstdio>

4. it works, (also std::cout) when i load the external lib after running 
ExecutionEngine::create(...)

is this expected behavior?
if yes, is it possible to not load an external lib permanently? one of the 
key-features of using jit are online-updates - this would not work because, 
once i have loaded the lib the sequence will never be "right" again.

thanks for your help,
stefan

On Tuesday 28 July 2009 05:13:49 pm you wrote:
> hello,
>
> after a lot of tries i could assemble a pretty small version of what either
> triggers a bug in LLVM or is caused by misuse of LLVM on my side. i would
> be very happy, if someone with more experience with the JIT could have a
> look on my code.
>
> the use-case:
> 	a class in a bitcode-file, loaded (jitted) by an app at runtime
> 	the app calls a static create inside the bitcode and then tries to call a
> 		member function of that class
>
> now that works, as long as there isn't the external shared library which
> holds the superclass for the class inside the bitcode. (does that work at
> all?)
>
> the cmake should work as long as you have llvm in your path.
> i use "cmake . -DCMAKE_BUILD_TYPE=DEBUG"
> then you can run it with
> "bin/LLVM_JIT_Test bitcode/CMakeFiles/bitcode_mod.dir/BitcodeMod.cpp.o
> lib/libcore.so"
> (assuming you are inside the project's directory)
>
> thank you very much,
> stefan.



More information about the llvm-dev mailing list