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

From: Elena Garrulo (egarrulo at gmail.com)
Date: Thu Jul 2 12:34:24 EDT 2009

2009/7/2 Eli Barzilay <eli at barzilay.org>

> On Jul  2, Elena Garrulo wrote:
> > Well, I finally nailed it down.  It would look like this (code
> > shrinked down from major example, not tested!) :
> >
> > ;; void fill_buffer (BYTE* buffer, DWORD* buffer_size);
> > (define fill_buffer
> >   (get-ffi-obj "fill_buffer"
> >                my_dll
> >                (_fun
> >                 (buffer : _pointer)
> >                 (buffer_size : ((_ptr io _DWORD)))
> >                 -> _void
> >                 -> (list buffer_size)))) ;; <- OUTPUT?
>
> I'm still not sure about the point of this -- is the foreign function
> supposed to put data in your block and tell you the size of the data
> through the extra return value (eg, instead of using 0 as a
> terminator, or instead of you giving it a block of the right size)?
> IMO, this doesn't sound like a good API.


You got the point. They are legacy Win32 APIs.

Thank you for your other suggestions.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20090702/a7e99946/attachment.html>

Posted on the users mailing list.