[plt-scheme] Using FFI with complex structures and input/output parameters?

From: Elena Garrulo (egarrulo at gmail.com)
Date: Wed Jul 1 10:32:14 EDT 2009

2009/7/1 Eli Barzilay <eli at barzilay.org>:
> The problem is here:
>
>                ;; OUT BYTE* pbRecvBuffer
>                (pbRecvBuffer :  (_vector o _byte cbRecvLength))
>                ;; IN OUT DWORD* pcbRecvLength
>                (cbRecvLength :  (_ptr io _DWORD))
>
> You can't use `cbRecvLength' like that.  You can use the `::' marker,
> where you put all the arguments to the wrapper explicitly at the
> front, but it still wouldn't work because the value that
> `cbRecvLength' will be bound to is a pointer.

Then, my question boils down to: with current FFI, can you use an
input/output parameter which holds the size of a buffer? For instance,
a function like:

void fill_buffer (BYTE* buffer, DWORD* buffer_size);

where buffer_size holds:
- size of buffer on input;
- size of written data on output;

has a mapping in FFI?

Thanks


Posted on the users mailing list.