Swig-Python-Cygwin-Windows-Problem

Jason Tishler jason at tishler.net
Mon Feb 24 08:44:18 EST 2003


Tim,

On Sat, Feb 22, 2003 at 09:36:33PM -0800, Tim Roberts wrote:
> Jason Tishler <jason at tishler.net> wrote:
> >On Sat, Feb 22, 2003 at 12:58:31AM +0100, Manfred Nowak wrote:
> >> gcc -shared   $SWIGMOD'.o'  $SWIGMOD'_wrap.o' \
> >>      -L /lib/python2.2/config  -lpython2.2.dll  -lc -o '_'$SWIGMOD'.dll'
> >                                 ^^^^^^^^^^^^^^^
> >You should not link directly with the DLL, libpython2.2.dll.  You
> >should instead link to the import library, libpython2.2.dll.a, by
> >using -lpython2.2 above.
> 
> "-lpython2.2" expands to libpython2.2.a.

Actually under Cygwin, "-lpython2.2" expands to the following in
decreasing priority:

    libpython2.2.dll.a
    libpython2.2.a

Note that Cygwin's ld has been modified to search for import libraries
first and then fall back to static ones.

For example:

    $ gcc -Wl,--verbose -o j j.o -L /lib/python2.2/config  -lpython2.2 2>&1 | fgrep python2.2.dll
    attempt to open /lib/python2.2/config/libpython2.2.dll.a succeeded

> "-lpython2.2.dll" expands to libpython2.2.dll.a.

Eventually, but only after two guaranteed misses:

    $ gcc -Wl,--verbose -o j j.o -L /lib/python2.2/config -lpython2.2.dll 2>&1 | fgrep python2.2.dll
    attempt to open /lib/python2.2/config/libpython2.2.dll.dll.a failed
    attempt to open /lib/python2.2/config/python2.2.dll.dll.a failed
    attempt to open /lib/python2.2/config/libpython2.2.dll.a succeeded

> Thus, I think his command line is, in fact, correct.

Even though Manfred's command line works, IMO it is not technically
correct and helped to cause me to arrive at an erroneous conclusion
about linking directly to the Cygwin Python DLL.  Unfortunately, this
discussion is not solving Manfred's real problem...

Jason

-- 
PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers
Fingerprint: 7A73 1405 7F2B E669 C19D  8784 1AFD E4CC ECF4 8EF6





More information about the Python-list mailing list