Re: [racket] FFI Pointer to Pointer

2012-06-10 Thread Thomas Chust
Freezerburn wrote: > [...] > 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? > [...] Hello, you probably want an output parameter created using a (_ptr o _my_c_struct-pointer) argument type specification in the binding of th

Re: [racket] FFI Pointer to Pointer

2012-06-10 Thread Freezerburn
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? On Jun 10, 2012

Re: [racket] FFI Pointer to Pointer

2012-06-10 Thread Joshua Ewulo
Say you have a struct. struct my_c_struct {}; my_c_struct *ptr = 0; // uninitialised pointer You need to prototype the function with a pointer to a pointer void my_func(my_c_struct **pptr); void my_func(my_c_struct **pptr) { *ptr = new my_c_struct; if (!*ptr) printf ("error no memory\n");