[Python-Dev] x86_64 Interix - Advise needed on size of long
jerker.back at telia.com
Sat Aug 4 16:54:33 CEST 2007
I'm in need of an advise how to handle sizeof long in python. I wanted a
x86_64 compile of python for Interix (that is NT POSIX subsystem with x86_64
Interix 6 SDK).
My first attempt to build failed due to the makefile insisted on linking as
shared libraries (works only in x86 with GNU ld). Tried autoreconf to get
rid of libtool - no luck.
Q1: Is the static build broken?
Q2: Anyone have a useable Makefile.am?
My second attempt was based on the VS2005 project and the previous Makefile.
Not to tire you with details, but for this to work I need to explicit assign
the sizeof long (replace all long types with explicit sized ones, int32_t,
There are 2 choices: All longs to 64bit (LP64 model) or all to 32bit (LLP64
model). Since Interix use LP64 the first alternative would be logic, but
considering compatibility with the Windows DLL, performance(?) and whatever,
I choosed the latter. A choice which later would turn me into trouble.
Here's how I am reasoning:
x64 Windows DLL = LLP64 model => sizeof(long) = 4
x86_64 Interix = LP64 model => sizeof(long) = 8
So, since the Windows build works, basically all long types in the code are
32bit (or at least works if they are 32bit). 64bit dependent variables like
pointers have already been taken care of. Right? While it sounds reasonable
as long as one are consistent, it's actually quite difficult to get it right
(and a lot of work).
To be precise, would this be OK?
long PyInt_AsLong(PyObject *);
int32_t PyInt_AsLong(PyObject *);
unsigned long PyOS_strtoul(char*, char**, int);
uint32_t PyOS_strtoul(char*, char**, int);
More information about the Python-Dev