[Pyrex] Platform dependent external declarations?

Francesc Altet faltet at carabos.com
Tue Feb 27 09:14:33 UTC 2007


Hi Greg,

A Dimarts 27 Febrer 2007 00:45, Greg Ewing escrigué:
> 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.

This is the approach I'm following now. However, the GCC keeps complaining:

src/hdf5Extension.c:5000: warning: pointer targets in passing argument 3 
of ‘H5Sselect_hyperslab’ differ in signedness

The declaration of the C header (hdf5.h) on Unix is:

typedef unsigned long long      hsize_t;

my external declaration in Pyrex looks like:

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

and, by looking at the generated code, Pyrex writes:

  PY_LONG_LONG __pyx_v_start;

(such __pyx_v_start variable that appears as 3rd argument 
to ‘H5Sselect_hyperslab’ function call) i.e. Pyrex is getting ride of 
the 'unsigned' qualifier.

Any hint of what is going on? Thanks!

-- 
>0,0<   Francesc Altet     http://www.carabos.com/
V   V   Cárabos Coop. V.   Enjoy Data
 "-"



More information about the Pyrex mailing list