<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 &lt;<a href="mailto:jewulo@gmail.com">jewulo@gmail.com</a>&gt; 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; //&nbsp;uninitialised&nbsp;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>&nbsp; &nbsp; *ptr = new my_c_struct;</div><div>&nbsp; &nbsp; if (!*ptr) printf ("error no memory\n");</div>
<div>&nbsp; &nbsp; else&nbsp;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">&lt;<a href="mailto:vince.raiken@gmail.com" target="_blank">vince.raiken@gmail.com</a>&gt;</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>
 &nbsp;Racket Users list:<br>
 &nbsp;<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>