[Pyrex] type definition

Francesc Alted falted at openlc.org
Sat May 3 14:09:36 CEST 2003


Hi,

Anybody knows how I can declare a type depending if I'm in a windows or in a 
UNIX platform and they are called differently?

For example, I'm trying to use Integers of 64 bits, but they are called
LONG_LONG on Windows (MSVC) and "long long" in UNIX (GCC).

I've tried to put in "type-longlong.h":

#ifdef _MSC_VER
#       define LL_TYPE LONG_LONG
#       define MY_MSC_VER 1
#else /*_MSC_VER*/
#       define LL_TYPE long long
#       define MY_MSC_VER 0
#endif /*_MSC_VER*/

and then, in the Pyrex code:

cdef extern from "type-longlong.h":
  cdef enum:
    MY_MSC_VER

if MY_MSC_VER:
  ctypedef LONG_LONG hsize_t
else:
  ctypedef long long hsize_t
    
cdef hsize_t long_long_variable

But the Pyrex compiler complains:
hdf5Extension.pyx:220:2: ctypedef statement not allowed here

How (if possible at all) can I get around on this?

-- 
Francesc Alted




More information about the Pyrex mailing list