[Pyrex] Platform dependent external declarations?

Greg Ewing greg.ewing at canterbury.ac.nz
Mon Feb 26 23:45:19 UTC 2007


Francesc Altet wrote:

> I'm having difficulties when using external C types whose sign depends
> on the platform.  I'm using a library that defines 'hsize_t' as being
> 'unsigned long long' in Unix and 'signed long long' in Win32

You should be able to simply do

   cdef extern from "hdf5.h":
     ctypedef long long hsize_t

Pyrex will generate code that uses the name hsize_t
to refer to the type, so the C compiler will pick
up the correct platform definition from the header
file.

--
Greg



More information about the Pyrex mailing list