[C++-sig] embedded Python: Access an object defined previously in C++ (original) (raw)

Markus Heller markus at relix.de
Fri Dec 23 03:32:39 CET 2005


Hi Stefan,

> 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.

You see, I have a rather big struct in my C++ memory and I want to retain a certain flexibility and give the users of my application the chance to do some customized data processing. To me the ideal way is to offer them access to the data through python.

Best wishes, Markus



More information about the Cplusplus-sig mailing list