[r6rs-discuss] Chez Scheme FFI question: returning structs

Aaron W. Hsu arcfide at sacrideo.us
Wed Apr 28 23:38:25 EDT 2010


> Thanks for the pointer Aaron!
> 
> Can you point out where in the sockets code you pass or return a struct 
> value (and not a pointer to a struct)? I looked through the code but 
> perhaps I missed it.
 
I'm not sure that I do this literally, but there are places where I
return bytevectors or buffers, the concept is the same. Create
extractors for the data from the bytevectors, using ffi-bind as
appropriate. The basic idea is that you have a block of bytes that
needs to be converted, so do the conversion in Scheme once the struct
is returned.
 
    Aaron W. Hsu



More information about the r6rs-discuss mailing list