Modify a C++ instance from the embed python interpreter

Wezzy wezzy at despammed.com
Sun Aug 28 08:35:19 EDT 2005


Diez B. Roggisch <deets at nospam.web.de> wrote:

> 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();
> }

Can you post few line of code ?

> 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

well i'll look to SIP but i prefer to use swig because it can interface
C++ with other language such as ruby

-- 
Ciao
Fabio



More information about the Python-list mailing list