Invalid handle.

Michael Cherkassoff
Fri Oct 17 20:04:00 GMT 1997


I am trying to port Python to Win95 using GNU Win32,

The Python itself works fine, but I have problems
compiling modules and importing .DLLs.

The latest thing is the error message:

Import error: DLL load failed: The handle is invalid.

I grepped the files in both Python and Cygnus directories
(includes) and couldn't find the message.

Is this Python or GNU Win message? What does it mean?
Anything can be done?

Here are the details:

I've build the Python successfully, just ./configure
(some minor editing - getting rid of signalmodule)
and make.

However, I guess, by  default this configure does not support

Hence I defined WINDOZE in config.h (that was produced)
and edited importdl.c to
add  || defined(WINDOZE) to ifdef MS_WINDOWS, where it 
has the code to allow .DLLs.

Also I added || defined(WINDOZE) at where the import is
being made and where it was ifdef MS_WIN32.
(I actually tried also ifdef MS_WIN16, but it gave me

Import error: DLL load failed: The error code is 0.

And built Python.

Then I made multiarray.dll from multiarray.o by the method
suggested by Fergus Henderson (using Makefile.DLLs)

I used both RELOCATABLE=yes and RELOCATABLE=no
with the same results (what is the difference? and what
should it be for Python?)

One of the very strange things was that whereas multiarray.pyd
from NumPy distribution for Windows from MSVC++ is about 18 Kb,
the multiarray.dll that I got was > 1Mb.

Also if it is any help - Attempt to import this into MSVC++
Python creates Page Fault.

In general I would appreciate any hints on how to build DLLs
for Python using GNU Win, how to use DLLs or PYDs from MSVC++ in
GNU Win Python and vise versa.

Any help will be greatly appreciated.

Michael Cherkassoff  (
Department of Geography,                 Tel: (604) 822-2663
University of British Columbia, B.C.     Fax: (604) 822-6150
For help on using this list (especially unsubscribing), send a message to
"" with one line of text: "help".

More information about the Cygwin mailing list