<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> </div>
<div>Any help will be much appreciated. Thanks!</div>
<div><br><br> </div>
<div class="gmail_quote">On Sat, Oct 9, 2010 at 3:55 PM, OvermindDL1 <span dir="ltr"><<a href="mailto:overminddl1@gmail.com">overminddl1@gmail.com</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; 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">antseabra@gmail.com</a>>:<br>

<div>
<div></div>
<div class="h5">> I'm on Windows using MinGW...<br>><br>> 2010/10/9 OvermindDL1 <<a href="mailto:overminddl1@gmail.com">overminddl1@gmail.com</a>><br>>><br>>> 2010/10/5 António Saragga Seabra <<a href="mailto:antseabra@gmail.com">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>