By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,732 Members | 1,388 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,732 IT Pros & Developers. It's quick & easy.

Newb, using Python in win32 app, how to import c++ modules created with swig from an .exe

P: n/a
Hi, I'm using Python in my win32 app by linking to the python23.dll.
I'm trying to expose some c++ code in my app to Python so I can make
application calls from Python scripts (according to the Python windows
FAQ I shouldn't have to make a seperate dll, see link below). I
create a MyModule.i file for swig which contains a simple test c++
class. I run swig on it with the following options: swig -python -c++
-includeall -shadow MyModule.i, and as expected it creates a
MyModule.py and MyModule_wrap.cxx. When I can compile the .cxx
wrapper file into my app, my app now exports init_MyModule. This
seems good. The problem is, how do I import this module into Python?
If I run the MyModule.py script swig generated, it tries to import the
swig-generated shadow class module named _MyModule, which in turn
looks for a lib named _MyModule.lib and dll named _MyModule.pyd, which
don't exist. I need to point Python to the code in my application
(which is named MyApp.exe). I'm guessing there might be a swig option
which does this, but I can't find it in the documentation. For
reference I've included a link to the relevant part of the Python
Windows faq below. Much thanks for any help.

- Jon Moldover
Frog City Sofware
fl***@frogcity.com

http://www.python.org/doc/faq/window...ws-application
Jul 18 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.