Ctypes compatibility

Alec Taylor alec.taylor6 at gmail.com
Tue Jan 10 23:42:47 EST 2012


Use size_t

http://en.wikipedia.org/wiki/C_data_types#Size_and_pointer_difference_types

On Wed, Jan 11, 2012 at 2:20 PM, Evan Driscoll <edriscoll at wisc.edu> wrote:
> Might as well ask another question of the list.
>
> I've written a ctypes-based Python wrapper around the 'readdir'
> function. (I want access to the dt_type field of the result, without
> calling stat().)
>
> However, it feels very... fragile. What happens on a different *nix
> which uses a different size of integers? Is Linux even consistent
> between 32 and 64 bits? (That's a rhetorical question.) What happens on
> a different *nix with the fields in a different order, or without a
> dt_type field?
>
> It somehow feels wrong that you get way less help with this than you
> would get even from C. Is that just how it is with ctypes? Or is there
> some way around it? I'm sort of tempted to write a C module whose sole
> purpose is to wrap readdir...
>
> Evan
>
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list