mmap problem with dll

Mark Hammond MarkH at
Wed Dec 13 17:19:54 EST 2000

howard at wrote:

> I get the message 
>      EnvironmentError: [Errno 2] No such file or directory
> on the mmap object creation call.
> I traced it back to the _get_osfhandle call trying to get the
> operating system equivalent of the run-time library handle.
> So, I rebuilt the dll to use the Python 2.0 includes and tried it
> under 2.0.  It still doesn't work.  The built-in mmap DOES work.
> In the dll, I printed out the result from _get_osfhandle....sure
> enough it returned -1.  In the Python code, I printed out
> msvcrt.get_osfhandle and it works correctly.

You almost certainly are compiling without the "/MD" ("/MDd" for debug) 
compiler option (aka "Runtime in multi-threaded DLL").  The symptoms are 
very much like the DLL and Python itself arent sharing the same runtime, 
and so can't pass CRT handles or abjects between them.


More information about the Python-list mailing list