<html><head></head><body bgcolor="#FFFFFF"><div>I think I might have been unclear about what I was asking. If we assume I have that same code you just posted, how would I go about using it through the Racket FFI? I know I can define a _my_c_struct-pointer, but how do I make a pointer to that pointer to pass to the C function?<br></div><div><br>On Jun 10, 2012, at 5:42 AM, Joshua Ewulo <<a href="mailto:jewulo@gmail.com">jewulo@gmail.com</a>> wrote:<br><br></div><div></div><blockquote type="cite"><div><div>Say you have a struct.</div>struct my_c_struct {};<div>my_c_struct *ptr = 0; // uninitialised pointer</div><div><br></div><div>You need to prototype the function with a pointer to a pointer
</div><div>void my_func(my_c_struct **pptr);</div><div><br></div><div>void my_func(my_c_struct **pptr)</div><div>{</div><div> *ptr = new my_c_struct;</div><div> if (!*ptr) printf ("error no memory\n");</div>
<div> else printf ("aye memory\n");</div><div>}</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br><br><div class="gmail_quote">On 10 June 2012 01:57, Vince Kuyatt <span dir="ltr"><<a href="mailto:vince.raiken@gmail.com" target="_blank">vince.raiken@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I need to be able to define a variable which is an un-initialized pointer to a C struct, then pass a reference to that pointer to a C function. How would I go about doing this?
<br>____________________<br>
Racket Users list:<br>
<a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
<br></blockquote></div><br></div>
</div></blockquote></body></html>