calling member via JIT


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
(assuming you are inside the project's directory)

thank you very much,

jit_test.tar.gz (2.39 KB)

new day, new luck :wink:

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
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

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,