[LLVMdev] A question about calling external function in JIT
Jeff Fifield
fifield at colorado.edu
Thu Oct 6 12:45:07 PDT 2011
Hi Wei-Fan,
It is possible to reference an external function from JITed code. You
can use the llvm::sys::DynamicLibrary routines to load your dynamic
library. After loading the library, the JIT engine should be able to
locate 'foo'.
Jeff
On Thu, Oct 6, 2011 at 1:28 PM, Wei-Fan <wfchiang at cs.utah.edu> wrote:
> Hello Sir,
>
> My name is Wei-Fan Chiang.
> I am now a graduated student of U. of Utah.
> I have a question about call external function in JIT.
>
> Suppose I have a simple program:
>
> int main (int argc, char *argv[]) {
> int i = 2, j = 3, k;
> k = foo(2, 3);
> return 0;
> }
>
> "foo" is an external function (non-native function define in dynamic
> library) made by us.
> In JIT, we just need to natively execute foo and pass the result back.
> That means, we want to treat "foo(2, 3)" as a constant while doing JIT.
>
> Is it possible?
>
> Thanks.
>
> Regards,
> Wei-Fan
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
More information about the llvm-dev
mailing list