[C++-sig] Injecting python derived C++ types at runtime in embedded environment

Brian Hall bhall at midwaygames.com
Sat Jul 10 00:01:58 CEST 2004


Hello all,

I have a C++ application where I want to be able to provide the user with 
creating a derived python class at runtime.

I basically have 3 C++ classes that I want to expose to python, and then at 
any time the user will be allowed to create a new custom python class derived 
from one of the 3 exposed classes.  They will also be allowed to modify their 
code and run it again.

Should I expose the types using the BOOST_PYTHON_MODULE macro? Or can I expose 
them after PyInitialize directly into the __main__ namespace?  Is it possible 
to reevaluate the code and have it update the derived class or will I have to 
purge the globals in some fashion?

Any help would be much appreciated.

Brian Hall




More information about the Cplusplus-sig mailing list