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

From: Eli Barzilay (eli at barzilay.org)
Date: Wed Jul 1 10:14:21 EDT 2009

On Jul  1, Elena Garrulo wrote:
> Thank you for your corrections and suggestions. I've applied them
> and reduced again source code to help diagnosis, but the error
> message at "SCardTransmit" call is still there ("zero?: expects
> argument of type <real number>; given #<cpointer>"). I'm sending
> modified sources as attachment to avoid breaking indentation.

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.

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!


Posted on the users mailing list.