Using Python for Science: Cygwin versus Native

Norman Vine nhv at yahoo.com
Sat Sep 22 20:18:17 EDT 2001


gb at cs.unc.edu wrote in message news:<ug09frw8y.fsf at cs.unc.edu>...
> 
> On the Windows platform I can choose between two versions of Python,
> native win32 and cygwin. They are both fine for straight Python
> programming but when it comes to extensions they both appear to have
> weaknesses. 
> 
> Question 1: Is there a way to access Windows DLL's and/or .obj files
> from the Cygwin hosted Python?
> 

In order to use access a windows dll from cygwin you need an import library
Note that this will only work for 'C' and not 'C++' libraries

here is an example of making an import library for glut32
this assumes that the dll lib and header are all in current directory

echo EXPORTS >glut32.def
nm glut32.lib | grep ' T _' | sed 's/.* T _//' >>glut32.def
dlltool -k --output-lib libglut32.a --dllname glut32 --def glut32.def

Of course you will still need a way to access the C code from python
but SWIG should come in handy


Cheers

Norman Vine



More information about the Python-list mailing list