[PythonCE] PythonCE on the ARM emulator
coder_infidel at hotmail.com
Sat Dec 17 04:04:18 CET 2005
----- Original Message -----
From: "Thomas Heller" <theller at python.net>
To: <pythonce at python.org>
Sent: Friday, December 16, 2005 2:10 AM
Subject: [PythonCE] PythonCE on the ARM emulator
> Since Luke Dunstan has ported ctypes to windows CE, so I got interested
> in this platform. I don't have a Windows CE device, but I found the MS
> Device Emulator (1.0, Community Preview):
> To get started, I installed the emulator and tried to install the
> current CE binaries on it. The interactive interpreter works as far as
> I can tell, except that I cannot import any extension modules in it.
> When I try this, 'import _winreg' or 'import socket', Python is
> terminated without any indication what was wrong.
> Has anyone with more experience tried to run Python on this 'platform'?
I just tried this and I get the same results. Running it in the debugger
shows that the crash occurs in GetPythonImport() in Python/dynload_win.c.
The code calls LoadLibrary() and then assumes that the returned HMODULE is
actually the base address of the DLL in memory, which is true for other
versions of Windows. The code tries to read the import table from the DLL
file headers to determine whether it is linked to the correct version of
Python (python23.dll in this case). I checked on my PDA and even though it
tries to read from an invalid address it does not crash, so it doesn't cause
any problems. Apparently the emulator has better memory protection (or
perhaps it is the slightly newer OS running on the emulator) and doesn't
The ideal solution to this problem would be to find the real module address
from the HMODULE: does anyone know how to do this? The easy solution would
be to use #ifndef MS_WINCE around this code because it is not critical and
is merely a safeguard against loading Python extensions for the wrong
version of Python.
More information about the PythonCE