Creating C modules for Python under Cygwin

Martin v. Löwis loewis at informatik.hu-berlin.de
Mon May 6 10:09:30 EDT 2002


Jason Tishler <jason at tishler.net> writes:

>     1. Win32 Python used a DLL Python library too
>     2. DLLs appear to be en vogue on Windows (and Cygwin)
>     3. shared extensions worked!
> 
> I guess that #3 is the most compelling. :,)

I still wonder whether they would have worked when linked against the
executable. Your reasoning was "linking against a static library does
not work, ergo we need --enable-shared". As Alex explains, this
reasoning might be flawed.

>     $ dlltool --export-all --output-def python2.3.def python.exe
>     $ dlltool --dllname python.exe --def python2.3.def --output-lib libpython2.3.dll.a
> 
>     $ make # [2]
[...]
>     [2] make succeeds this time because we are linking against an import
>         library now.

I think this is what Alex had in mind.

>     >>> import _socket
>     Traceback (most recent call last):
>       File "<stdin>", line 1, in ?
>     ImportError: dlopen: Win32 error 193
> 
>     $ fgrep 193 /usr/include/w32api/winerror.h 
>     #define ERROR_BAD_EXE_FORMAT 193L

Can you tell whether it complains about _socket.pyd, or about the
executable?

> > I thought this was overstated, [snip]
> 
> Please feel free to question any of my statements.

Your original statement was "Cygwin, like Win32, requires a shared
python library." It does not require that - it only requires it if you
have shared extensions. And even then, it might be the case that it
doesn't require a shared python library.

Regards,
Martin






More information about the Python-list mailing list