[plt-scheme] ffi _ptr mode i

From: Jon Rafkind (workmin at ccs.neu.edu)
Date: Fri Dec 30 21:57:37 EST 2005

Could something be added to the ffi documentation about the usage of `i' 
for the _ptr type? I was accidentally using (_ptr i _SomeStruct) when I 
really just wanted _SomeStruct-pointer. I guess this is obvious but I 
started second guessing myself after reading the documentation a few 
times. Strangely my program didnt crash regardless of which form I 
used.. why is this?

I wont complain without at least trying to help so here is my version of 
what the documentation should say.

`|i|', indicating an /input/ pointer argument: the wrapper will arrange 
for the function call to receive a value that can be used with the 
|type| and to send a pointer to this value to the foreign function. This 
mode only needs to be used with primitive C types such as _int or _long. 
Structures can simply be passed as _foo-pointer. After the call the 
value is discarded.

Posted on the users mailing list.