[Pyrex] Platform dependent external declarations?

Stefan Behnel stefan_ml at behnel.de
Mon Feb 26 19:44:14 UTC 2007



Francesc Altet wrote:
> El dl 26 de 02 del 2007 a les 18:31 +0100, en/na Stefan Behnel va
> escriure:
>> 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 (Win32
>>> doesn't support such an 'unsigned long long' type. My current approach
>>> is to declare it as 'signed long long', but that generates warnings when
>>> compiling the code on Unix (although the code works well):
>>
>> You should consider doing this in a C-header file that you cimport where you
>> need it.
> 
> Mmm. Perhaps I've explained this badly: it is the C-library that I try
> to link with Pyrex who is declaring this differently for Unix and Win
> platforms (so, there is already a C-header who does that). My problem is
> how to get the external declaration correctly in Pyrex for both
> platforms.

ctypedef it as "external from yourheader.h" in a .pxd and rely on the
C-compiler to do the right thing? Just define it as "long long" here or
whatever you prefer. Pyrex does not care.

Stefan



More information about the Pyrex mailing list