[LLVMdev] Help! Linking to external functions.
rmann at latencyzero.com
Tue Jan 15 18:09:18 PST 2013
Hi. I've had moderate success so far with LLVM. I've got an OS X app in Xcode that is able to parse my DSL, generate code into an LLVM Module, and pass it to an ExecutionEngine to execute.
But now I'm stuck.
That code needs to reference an external function I define in my app. If I define that function in the same source file as the file that invokes the ExecutionEngine, everything is fine. But if I define that function in a separate file, it does not work correctly (LLVM says "LLVM ERROR: Program used external function 'foo' which could not be resolved!").
I've verified that the function is in fact linked in, by calling it once from the same code that invokes the ExecutionEngine. This works. But for some reason, LLVM can't see it. It is 'extern "C"'.
What am I missing? Thanks!
More information about the llvm-dev