[C++-sig] instantiating python objects within C++

Gavin Doughtie gdoughtie at anim.dreamworks.com
Fri May 23 23:41:29 CEST 2003

I just did this last week. You DO have to run the interpreter, which 
then loads a python script, which imports your exported C++ class that 
you've written (or generated) a wrapper class for that has the 
call_method implementations of your virtual functions. When you extract 
to a pointer of your base class, you've really got a pointer to the 
wrapper class which calls back into the python code.

Stefan Seefeld wrote:
> Hi Adam,
> Adam Hupp wrote:
>> Try looking at libs/python/test/embedding.cpp.  It has a nice example
>> of this usage.  
> thanks for the pointer. I looked, but the main question is still
> unanswered, as the example instantiates an object 'implemented' in
> python (derived from a C++ type). Do I really have to run the
> interpreter to instantiate a python-wrapper-object around my own type ?

Gavin Doughtie
DreamWorks SKG

More information about the Cplusplus-sig mailing list