Extending Python on Windows

Gregory Propf gpropf at cfl.rr.com
Mon Apr 1 20:39:45 EST 2002


I am trying to learn how to make Python extensions for a cross platform 
project I'm thinking about.  Basically the CPU intensive stuff will be 
in C or C++ and the GUI will be done with wxWindows in python.  I will 
need to build python extensions for this.

Attached to this email is my version of the "spam" sample code that you 
find on the python website.  The instructions for compiling on *Linux* 
are in a comment at the end.  This procedure works fine and I am able to 
use the extension.  On Windows (NT 4.0 sp6) I have tried to build this 
extension using the version of gcc and ld that comes with cygwin.  The 
only change is that --shared is replaced with -c (--shared does not seem 
to work on Windows) and the .so extension is replaced with .dll.

Even on Windows the extension builds and links just fine.  I invoke 
python just the way the comments show (the LD_LIBRARY_PATH seems to be 
necessary on both Linux and Windows).  When I try to do 'import spam' in 
python I get an error that mentions dlopen and has a message like 
"Windows error 32??????????" (i.e. very big number).  I wish I had the 
full error text but I didn't save it and can't get to it from home. 
Just thought someone might know what this is and have a simple fix.  I 
will post again tomorrow with the full error text (but the "error 
number" is so huge I suspect it's bogus).


-- 
You see, "state of the art" Microsoft Office applications sport a
nifty feature called "smart quotes." (Rule of thumb--every time
Microsoft uses the word "smart," be on the lookout for something
dumb).  - John Walker, founder of Autodesk.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: spammodule.c
URL: <http://mail.python.org/pipermail/python-list/attachments/20020401/9812446c/attachment.c>


More information about the Python-list mailing list