Modify a C++ instance from the embed python interpreter
Diez B. Roggisch
deets at nospam.web.de
Sat Aug 27 14:08:40 EDT 2005
Wezzy wrote:
> Hi, is there a tool that automatically expose an object to python? i
> have an instance of a C++ (or ObjC) object and i want to pass it to the
> embed interpreter that runs inside my program.
> Python code have to call c++ method and register some callback.
>
> I know that swig helps when python creates c++ instance but i've the
> instance and i want to use it with python.
That is the same case, wrt SWIG - the objects methods get accessed by
functions like
int Object_foo(Object *s) {
return s->foo();
}
So passing a exiting object reference to such a function will work. You
might also consider using SIP, it appears to me to be much more OO.
Diez
More information about the Python-list
mailing list