[C++-sig] Calling member function of object created in C++ via embedded Python

Ron Brown, Jr. rbrown at gamry.com
Fri Apr 13 21:23:26 CEST 2007


Roman,

Thanks for the reply.  Believe me, I looked at all of those links before 
posting. ;)

However, regarding your response of:

Roman Yakovenko wrote:
 > namespace bpl = boost::python;
 > bpl::object py_wo( World() );
 > bpl::call_method<void >(py_wo, "set", "Hello World");
 >
 > I think this should work

Now unless I'm just misunderstanding, what you're doing there is not 
exactly what I'm trying to do.  Wouldn't that code just create ANOTHER 
object of class World on the Python side?  Again, I'm embedding Python 
in a C++ app, and what I'm trying to do is just pass an 
already-instantiated object from the C++ through to Python, and then in 
Python, call one of that particular object's member functions.  I want 
to use the SAME object in both C++ and Python.

- Ron




More information about the Cplusplus-sig mailing list