newbie: python/C extensions in cygwin

Jason Tishler jason at
Sun Jan 26 06:06:36 CET 2003


On Sun, Jan 26, 2003 at 02:42:41AM +0000, Mark Higgins wrote:
> Ah - found the prob - cygwin stuck libpython2.2.dll into /bin

Which is correct.  DLLs which are loaded automatically by the Windows
loader instead of dlopen()-ed by the application go in /usr/bin.

> instead of some more reasonable directory like /lib or /usr/lib.

Note, that the import library libpython2.2.dll.a is in

> So I needed -lpython2.2 and -L/bin in the compile line.

No, you need to supply -L/usr/lib/python2.2/config -lpython2.2 while
linking and -DUSE_DL_IMPORT while compiling.  Note that you should link
against the import library instead of directly against the DLL.

BTW, if you use distutils, then the above will happen automatically.

However, your post has got me thinking that maybe make install under
Cygwin should copy libpython2.2.dll.a to /usr/lib too?  This would
facilitate building shared extensions without using a tool like


PGP/GPG Key: or key servers
Fingerprint: 7A73 1405 7F2B E669 C19D  8784 1AFD E4CC ECF4 8EF6

More information about the Python-list mailing list