[Python-Dev] x86_64 Interix - Advise needed on size of long

Jerker Bäck jerker.back at telia.com
Sun Aug 5 17:45:52 CEST 2007


Hello Martin,

> > You mean I should list all of these in "Modules/Setup"?
> Exactly so. They are already listed - just uncomment them all
> (with proper command line flags and libraries where necessary).
OK, I will try to get it compiled and tested.

Meanwhile, you asked so:
> I still don't understand. Are you *certain* that these are LP64
> libraries? Can you kindly refer to some official document that says
> Interix uses LP64 on AMD64?
MS is surprisingly very quiet of the POSIX subsystem and the Interix BSD
implementation, so it's hard to find any official info on the net. But here
is one the developers:
<http://blogs.msdn.com/shan/archive/2006/12/12/hi-there.aspx>
In Interix SDK releasenotes.htm (SDK download):
"64-bit compilation supports the LP64 data model."
Interix general:
<http://www4.osnews.com/story/5751/Review_of_Windows_Services_for_UNIX_3.5>
<http://www.interopcommunity.com>

To find details on how it all really works, one will have to look in the
headers and try different features oneself. (Which actually is pretty fun
because it's really fast and usually works well). The SDK comes with support
for x86, x86_64 (EM64T or AMD64) and IA64.

> And if so, how did Microsoft manage to build them, if their compiler
> does not support LP64? (I see you kind of answer that below - although
> I'm unsure what "translate all longs to long long means - you mean
> literal text replacement?)
Sure, cc precompiles the source file to a temporary file, flip it, runs a
conversion tool - "l2ll" => all <long> are converted to <long long> and
finally compiles the converted file. The compile is done via a call from
POSIX to the Windows subsystem and the compiler found in the POSIX path
environment. To understand the details one has to know that the POSIX
environment runs directly on top of the NT kernel and know nothing of
Windows, Windows paths etc. This is kind of a compile on the fly. The
libraries are also of two kinds: 
1 The core POSIX libraries - part of the OS, uses DDK tools
2 Interix SDK - BSD libc and utils, uses cc and Interix gcc (x86 only)

The DDK tools is turned to LP64 support via special defines in the headers.
But here is some unclear issues with functions directly exported from the OS
native LLP64 libraries (ntdll.dll) - don't know how this is solved.
 
Somewhere here lies the reason why cc is hard to use with Visual Studio and
why the long type is such a nuisance.

I also tried the Intel x64 PE compiler (for better C99 support), but it
produces applications which relies on Windows API functions (e.g.
VirtualAlloc, LoadLibrary) and thus cannot be used in POSIX.
 
Cheers,
Erik



More information about the Python-Dev mailing list