[LLVMdev] Help! Linking to external functions.
Rick Mann
rmann at latencyzero.com
Wed Jan 16 02:07:38 PST 2013
Solved my own problem.
I had declared my function inside an 'extern "C"' block like this:
#ifndef __cplusplus
extern "C" {
#endif
Notice my error? Should be "#ifdef", not "@ifndef".
Durrrr…
--
Rick
On Jan 15, 2013, at 18:09 , Rick Mann <rmann at latencyzero.com> wrote:
> 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!
>
> --
> Rick
>
>
>
>
> _______________________________________________
> 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