[racket-dev] [racket] newbie: foreign C structure definition question

From: Sam Tobin-Hochstadt (samth at ccs.neu.edu)
Date: Wed Nov 17 07:58:56 EST 2010

On Wed, Nov 17, 2010 at 2:12 AM, Eli Barzilay <eli at barzilay.org> wrote:
> Two hours ago, Sam Tobin-Hochstadt wrote:
>> Python's 'ctypes' library, which also uses libffi under the hood, has arrays:
>>   http://docs.python.org/library/ctypes.html#arrays
>> and also unions, which we don't have:
>>   http://docs.python.org/library/ctypes.html#structures-and-unions
>> So it seems like this should be possible, and maybe we can even use
>> their code.
> They guy who did ctypes knows how to deal with the libffi internals.
> (He did the msvc version of the code.)
> If you look through the libffi documentation you'll see no mention of
> arrays, and an explicit mention of "no special support for unions".

I understand that, but ctypes proves 3 things
 - it can be done
 - there is code to read and people to ask to figure out how
 - Python(!) has a nicer FFI than us for this.
sam th
samth at ccs.neu.edu

Posted on the dev mailing list.