[Python-Dev] Baffled on Windows

Tim Peters tim.one@home.com
Thu, 11 Jan 2001 00:03:51 -0500


In version 2.26 of mmapmodule.c, Guido replaced (as part of a contributed
Cygwin patch):

#ifdef MS_WIN32
__declspec(dllexport) void
#endif /* MS_WIN32 */
#ifdef UNIX
extern void
#endif

by:

DL_EXPORT(void)

before initmmap.

1. Windows Python can no longer import mmap:

>>> import mmap
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ImportError: dynamic module does not define init function (initmmap)
>>>

This is because GetProcAddress returns NULL.

2. Everything's fine if I revert Guido's change (although I assume that
breaks Cygwin then).

3. DL_EXPORT(void) expands to "void".

4. The way mmapmodule.c is coded and built after Guido's change appears to
me to be the same as how every other non-builtin module is coded and built
on Windows.  For example, winsound.c, which uses DL_EXPORT(void) before its
initwinsound and where that macro also expands to "void".  But importing
winsound works fine.

Since what I'm seeing makes no consistent sense, I'm at a loss how to fix
it.  But then I'm punch-drunk too <0.7 wink>.

Any Windows geek got a clue?