[C++-sig] embedded Python: Access an object defined previously in C++

Stefan Seefeld seefeld at sympatico.ca
Thu Dec 22 18:04:37 CET 2005

Markus Heller wrote:

> So do you have any hint for me? Where can I get some more information? As 
> said, I want to create a Python object in C++ and use it in Python 
> afterwards. 

If it is a pure python object, and if you want to use it in python (only ?),
why do you want to create it in C++ ?
What type will your object have ? A built-in python type or a type defined
in your own python script ? What do you want to do with that object from
within your C++ program before handing control back to python ?

The boost.python tutorial (http://boost.org/libs/python/doc/tutorial/doc/html/index.html)
as well as the reference manual (http://boost.org/libs/python/doc/v2/reference.html)
should get you started. You may also look into example code in boost/libs/python/test,
in particular boost/libs/python/test/exec.cpp.


More information about the Cplusplus-sig mailing list