With <a class="el" href="http://llvm.org/doxygen/classllvm_1_1ExecutionEngine.html#a78c977f1f7c8dab32c31782b2d55c6d4">updateGlobalMapping</a> from you execution engine ?<br><br>Olivier.<br><br><br><div class="gmail_quote">
2010/10/9 António Saragga Seabra <span dir="ltr"><<a href="mailto:antseabra@gmail.com">antseabra@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div>Hi,</div>
<div> </div>
<div>That seems really simple... just changing the function pointer. But how to do it for the 'printd' function in the Kaleidoscope example?</div>
<div>An example how to do this would be super-great. </div><div class="im">
<div> </div>
<div>Any help will be much appreciated. Thanks!</div>
<div><br><br> </div>
</div><div><div></div><div class="h5"><div class="gmail_quote">On Sat, Oct 9, 2010 at 3:55 PM, OvermindDL1 <span dir="ltr"><<a href="mailto:overminddl1@gmail.com" target="_blank">overminddl1@gmail.com</a>></span> wrote:<br>

<blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;" class="gmail_quote">2010/10/9 António Saragga Seabra <<a href="mailto:antseabra@gmail.com" target="_blank">antseabra@gmail.com</a>>:<br>


<div>
<div></div>
<div>> I'm on Windows using MinGW...<br>><br>> 2010/10/9 OvermindDL1 <<a href="mailto:overminddl1@gmail.com" target="_blank">overminddl1@gmail.com</a>><br>>><br>>> 2010/10/5 António Saragga Seabra <<a href="mailto:antseabra@gmail.com" target="_blank">antseabra@gmail.com</a>>:<br>

>> > Hi<br>>> ><br>>> > Thank you for your help! Followed your suggestion closely and changed<br>>> > the<br>>> > tutorial library function<br>>> ><br>>> > extern "C"<br>

>> > double printd(double X) {<br>>> >   printf("%f\n", X);<br>>> >   return 0;<br>>> > }<br>>> > into<br>>> ><br>>> ><br>>> > export "C" {<br>

>> ><br>>> >  void printd(double X) { printf("%f\n", X);return 0;}<br>>> ><br>>> >  typedef void(*pfunc)(double);<br>>> ><br>>> > }<br>>> ><br>>> > adding in main()<br>

>> ><br>>> > //typedef void(*pfunc)(double);<br>>> ><br>>> > pfunc printd;<br>>> ><br>>> > HMODULE self = GetModuleHandle(0);<br>>> ><br>>> > printd = (pfunc)GetProcAddress(self, "printd");<br>

>> ><br>>> ><br>>> ><br>>> > However I'm getting the same error message. It would be really great if<br>>> > you<br>>> > could point me to what I'm doing wrong<br>

>><br>>> None of that is necessary.<br>>><br>>> First of all, are you on Windows, or *nix?<br><br></div></div>Then the easiest thing to do is just stuff the function pointer in the<br>global pointer table in your module's JIT, single line of code (which<br>

I do not recall off hand, hence you should be asking the list, I will<br>forward this to the list as well).<br></blockquote></div><br>
</div></div><br>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
<br></blockquote></div><br>