how to pass C++ object to another C++ function via Python function

Diez B. Roggisch deets at nospam.web.de
Mon Apr 21 15:53:09 CEST 2008


grbgooglefan wrote:

> I am trying to pass a C++ object to Python function. This Python
> function then calls another C++ function which then uses this C++
> object to call methods of that object's class.

You might consider using a C++-wrapper like SIP, Swig or Boost::Python to do
this.

If you don't like that, all I can think of would be to return the address of
the object as integer, and pass that around. Then in the appropriate
C++-call, cast that integer to the object. butt-ugly and -10 style-points
though.

Diez



More information about the Python-list mailing list