[LLVMdev] LLVM-C: Calling functions contained in other libraries

F van der Meeren llvm-dev at code2develop.com
Thu Aug 12 14:21:52 PDT 2010

This might be a bug (or feature depending on vision of the software).

I have tried this with the global mapping, and it still won't work.
But by replacing the calling code with the JIT:

    LLVMCreateJITCompilerForModule(&engine, module, 0, &error);
    //LLVMAddGlobalMapping(engine, toCall, (void*)&NSFullUserName);
    LLVMGenericValueRef result = LLVMRunFunction(engine, toCall, 0, NULL);
    NSLog(@"Second attempt: %@", LLVMGenericValueToPointer(result));

It suddenly works like a charm, without any global mapping required.


On 12 Aug 2010, at 19:55, Eric Christopher wrote:

> On Aug 12, 2010, at 10:43 AM, F van der Meeren wrote:
>> Where am I going wrong here?
> Did you link against the library that contains the function?
> -eric

More information about the llvm-dev mailing list