[plt-scheme] Win32 FFI: Handling structures.
Elena Garrulo wrote:
> Program fails with: "zero?: expects argument of type <real number>;
> given #<cpointer>".
The problem stems from your declaration of pbRecvBuffer. cbRecvLength
is already cpointer-ized by the time _vector gets its hands on it:
> (_fun [...]
> (pbRecvBuffer : (_vector o _byte cbRecvLength))
> (cbRecvLength : (_ptr io _DWORD))
> [...] )
Also, note that when the underlying scard call succeeds, you are
returning a literal list of the four symbols error, ioRecvPci,
pbRecvBuffer, and cbRecvLength:
> -> (if (scard-ok error) '(error ioRecvPci
> pbRecvBuffer cbRecvLength) #f)
Ben