[Pyrex] arch-dependent base types

Greg Ewing greg.ewing at canterbury.ac.nz
Tue Oct 23 01:46:00 CEST 2007


David McNab wrote:
> What's the best way to import/wrap basic machine-dependent types like
> size_t and loff_t?

Most of the time you can get away with something like

   cdef extern from "relevant_header.h":
     ctypedef int size_t
     ctypedef int loff_t

It doesn't matter much what type you define it as,
because the C compiler will see the true definition
from the .h file.

If you come across a situation where the type does
matter to Pyrex, there are some conditional compilation
facilities in the latest version which could help.

--
Greg



More information about the Pyrex mailing list