[racket] size_t and FFI?

From: Tobias Hammer (tobias.hammer at dlr.de)
Date: Sun Feb 10 09:39:51 EST 2013

What about ffi/types, where we can add more common (and maybe system  
specific) types?

Tobias


On Sun, 10 Feb 2013 15:00:01 +0100, Matthew Flatt <mflatt at cs.utah.edu>  
wrote:

> I think that's likely to be right for all platforms where Racket runs,
> but we should define it in one place.
>
> Should we add `_size' to `ffi/unsafe', risking collisions with existing
> code? Or add `ffi/size' (or `ffi/size_t')?
>
> At Fri, 8 Feb 2013 20:45:07 +0100, Tobias Hammer wrote:
>> This should work:
>>
>> _uintptr = size_t
>> _intptr  = ssize_t
>>
>> Tobias
>>
>>
>> On Fri, 08 Feb 2013 20:40:43 +0100, Tony Garnock-Jones  
>> <tonyg at ccs.neu.edu>
>> wrote:
>>
>> > Hi all,
>> >
>> > When using Racket's FFI, is there a standard C numeric type
>> > corresponding to size_t? If not, should there be? Many C APIs expose
>> > functions along the lines of
>> >
>> >   ... myfunc(..., void *buf, size_t buflen, ...);
>> >
>> > and since size_t varies between 32- and 64-bit platforms, I'm unsure
>> > what to supply there.
>> >
>> > I note that in collects we have
>> >
>> > ./db/private/generic/socket.rkt:   (define _size_t _int)
>> > ./mred/private/wx/cocoa/image.rkt: (define _size_t _long)
>> > ./racket/draw/unsafe/jpeg.rkt:     (define _size_t _intptr)
>> >
>> > ... of which the last one looks most likely to work properly.
>> >
>> > Cheers,
>> >   Tony
>> > ____________________
>> >   Racket Users list:
>> >   http://lists.racket-lang.org/users
>>
>>
>> --
>> ---------------------------------------------------------
>> Tobias Hammer
>> DLR / Institute of Robotics and Mechatronics
>> Muenchner Str. 20, D-82234 Wessling
>> Tel.: 08153/28-1487
>> Mail: tobias.hammer at dlr.de
>> ____________________
>>   Racket Users list:
>>   http://lists.racket-lang.org/users

Posted on the users mailing list.