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

Discussion in 'Python' started by Jon Moldover, Oct 28, 2003.

  1. Jon Moldover

    Jon Moldover Guest

    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


    http://www.python.org/doc/faq/windows.html#how-can-i-embed-python-into-a-windows-application
    Jon Moldover, Oct 28, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. stefan
    Replies:
    3
    Views:
    420
    stefan
    Dec 8, 2004
  2. code_berzerker

    SWIG and char* newb questions :)

    code_berzerker, Jul 29, 2008, in forum: Python
    Replies:
    3
    Views:
    680
    Stefan Behnel
    Jul 29, 2008
  3. Ziv Tepman
    Replies:
    0
    Views:
    57
    Ziv Tepman
    Jan 21, 2014
  4. Ziv Tepman
    Replies:
    0
    Views:
    75
    Ziv Tepman
    Jan 21, 2014
  5. Chris Angelico
    Replies:
    0
    Views:
    61
    Chris Angelico
    Jan 21, 2014
Loading...

Share This Page