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

António Saragga Seabra antseabra at gmail.com
Sat Oct 9 09:31:58 PDT 2010


Hi,

That seems really simple... just changing the function pointer. But how to
do it for the 'printd' function in the Kaleidoscope example?
An example how to do this would be super-great.

Any help will be much appreciated. Thanks!



On Sat, Oct 9, 2010 at 3:55 PM, OvermindDL1 <overminddl1 at gmail.com> wrote:

> 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).
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20101009/62ab2cfd/attachment.html>


More information about the llvm-dev mailing list