<br><br><div class="gmail_quote">On 3 February 2010 14:13, Garrison Venn <span dir="ltr"><<a href="mailto:gvenn.cfe.dev@gmail.com">gvenn.cfe.dev@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
I have not used the C api or the interpreter, but via JIT one can use<br>
ExecutionEngine::addGlobalMapping(...) after the function decl in the<br>
foreign module. See if there is an equivalent in the C API, which will<br>
probably work for the interpreter given that this method is declared in<br>
ExecutionEngine. Also search for a previous email thread in this list.<br>
This discussion was fairly recent, and I believe I responded to it.<br></blockquote><div><br>This is interesting. I've just implemented dynamic loading of bitcode modules into lli for my project. I did this by hacking lli using the Linker class. Is ExecutionEngine::addGlobalMapping() preferred for this purpose?<br>
<br>-- James<br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>
Hope this helps<br>
<font color="#888888"><br>
Garrison<br>
</font><div><div></div><div class="h5"><br>
On Feb 3, 2010, at 8:53, Thomas W. wrote:<br>
<br>
><br>
> Hi everybody,<br>
><br>
> I'm currently working with LLVM (v 2.6) and I try to interpret LLVM bitcode<br>
> using the c API. Here is my problem : I have two LLVMModuleRef, M1 and M2,<br>
> M1 contains the function "funct()" and M2 contains a main function which<br>
> call "funct()" (M2 declares "funct()" too but it doesn't define it). If I<br>
> try to run the main function, I got the error "LLVM ERROR: Tried to execute<br>
> unknown external function: ...".<br>
><br>
> I build the interpreter giving it M1 and then I add M2. I can use the<br>
> LLVMFindFunction(...) to get the functions "funct()" and "main()" and if I<br>
> apply LLVMIsDeclaration(...) to these LLVMValueRef, I got false (so the<br>
> interpreter should know the two functions are defined and it should be able<br>
> to find their code).<br>
><br>
> Is there something to do to enable the interpreter to find a function in<br>
> another module ? I saw there is something like LLVMLinker::LinkModules(...)<br>
> in c++ but I didn't find the c version of this function.<br>
><br>
> Thanks in advance for your help,<br>
><br>
> Thomas.<br>
> --<br>
> View this message in context: <a href="http://old.nabble.com/Interpreter-with-multiple-modules.-tp27433312p27433312.html" target="_blank">http://old.nabble.com/Interpreter-with-multiple-modules.-tp27433312p27433312.html</a><br>

> Sent from the LLVM - Dev mailing list archive at Nabble.com.<br>
><br>
> _______________________________________________<br>
> LLVM Developers mailing list<br>
> <a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br>
<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br>
</div></div></blockquote></div><br>