[LLVMdev] LLVM ERROR: Program used external function 'printd' which could not be resolved!

OvermindDL1 overminddl1 at gmail.com
Sat Oct 9 07:55:16 PDT 2010


2010/10/9 António Saragga Seabra <antseabra at gmail.com>:
> I'm on Windows using MinGW...
>
> 2010/10/9 OvermindDL1 <overminddl1 at gmail.com>
>>
>> 2010/10/5 António Saragga Seabra <antseabra at gmail.com>:
>> > Hi
>> >
>> > Thank you for your help! Followed your suggestion closely and changed
>> > the
>> > tutorial library function
>> >
>> > extern "C"
>> > double printd(double X) {
>> >   printf("%f\n", X);
>> >   return 0;
>> > }
>> > into
>> >
>> >
>> > export "C" {
>> >
>> >  void printd(double X) { printf("%f\n", X);return 0;}
>> >
>> >  typedef void(*pfunc)(double);
>> >
>> > }
>> >
>> > adding in main()
>> >
>> > //typedef void(*pfunc)(double);
>> >
>> > pfunc printd;
>> >
>> > HMODULE self = GetModuleHandle(0);
>> >
>> > printd = (pfunc)GetProcAddress(self, "printd");
>> >
>> >
>> >
>> > However I'm getting the same error message. It would be really great if
>> > you
>> > could point me to what I'm doing wrong
>>
>> None of that is necessary.
>>
>> First of all, are you on Windows, or *nix?

Then the easiest thing to do is just stuff the function pointer in the
global pointer table in your module's JIT, single line of code (which
I do not recall off hand, hence you should be asking the list, I will
forward this to the list as well).




More information about the llvm-dev mailing list