I figured it out. I just made my main class a singleton and it worked fine... it always works right after I post a message =)
Stou Stou Sandalski wrote: > Hi, > > I have an application consisting of a main C++ class (and other > classes) stored inside a DLL. The application uses a small main > executable that links against the main DLL, then initializes and runs > the core class. The python bindings are inside a .pyd module that also > links against the core DLL file. I was able to generate the python > bindings against the core class using SWIG. The application can now > be run either by the bootstrap executable or through the python console > like: > > import foo > s = foo.MainClass() > s.run(); > > This is awesome, however I want to be able to launch python scripts > from within the application itself (no matter how it was started) and > supply these scripts with a "pointer" to the already initialized main > Class something like: > > import foo > > s = foo.GetMainClass() > s.someMethod(). > > I found this: > > http://docs.python.org/ext/extending-with-embedding.html > > but the problem is that I don't know how to "give" the python > interpreter a "pointer" to my class that will be compatible with the > already defined bindings that SWIG generated. I am trying to keep the > core application dll from knowing about the .pyd extension module. > > I apologize if this post belongs in a group dedicated to SWIG. > > Stou -- http://mail.python.org/mailman/listinfo/python-list