Questions on 64 bit versions of Python

"Martin v. Löwis" martin at v.loewis.de
Sat Jul 26 11:20:18 CEST 2008


> The end result of that is on a 32-bit machine IronPython runs in a
> 32-bit process and on a 64-bit machine it runs in a 64-bit process.


That's probably not exactly true (although I haven't checked).

When you start a .NET .exe program, the operating system needs to decide
whether to create a 32-bit or a 64-bit process (assuming the processor
supports 64-bit mode).

The Microsoft .NET commercial framework uses the PE architecture of the
executable to make that decision (or, rather, it doesn't decide at all,
but the underlying OS decides). The C# compiler (more specifically, the
assembly linker) offers a choice of setting the .NET architecture to
Itanium, AMD64, x86, or "any"; people use typically "any". This "any"
choice is implemented by setting the PE architecture to "any", and then
indicating to the .NET run-time that any other architecture would be
fine as well.

As a consequence, an architecture-any executable launches as a 32-bit
process on a 64-bit system. To have the executable launch as 64-bit
code, you must tell csc.exe to create an AMD64 binary (say), which
then means that the binary won't launch on a 32-bit system. I haven't
checked, but my guess is that IronPython uses architecture-any
executables (unless you adjust the build process).

Things are different in a DLL: an architecture-any DLL will load into
a 32-bit process as 32-bit code, and into a 64-bit process as 64-bit
code.

Regards,
Martin



More information about the Python-list mailing list