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

2008-05-09 Thread grbgooglefan
Yes, that worked. I "protected" the variable which I did not want to get freed. I incremented reference for that variable & it started working. Thanks for all your guidance. On May 3, 5:23 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > Python will do nothing with the pointer inside a PyCObj

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

2008-05-02 Thread Gabriel Genellina
En Fri, 02 May 2008 00:26:38 -0300, grbgooglefan <[EMAIL PROTECTED]> escribió: On Apr 22, 7:54 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: If you have a C function that receives a PyCObject, just include the   relevant headers (cobject.h) and you can retrieve the original pointer   us

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

2008-05-01 Thread grbgooglefan
On Apr 22, 7:54 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > > If you have a C function that receives a PyCObject, just include the   > relevant headers (cobject.h) and you can retrieve the original pointer   > using PyCObject_AsVoidPtr: > > void foo(PyObject *pyobj) > { >    TOriginalType

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

2008-04-21 Thread Gabriel Genellina
En Mon, 21 Apr 2008 11:19:24 -0300, Diez B. Roggisch <[EMAIL PROTECTED]> escribió: Gabriel Genellina wrote: You can't pass any arbitrary C object to a Python function. In this case you can use a PyCObject, a Python box around a void* pointer. See http://docs.python.org/api/cObjects.html Ne

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

2008-04-21 Thread Gabriel Genellina
En Mon, 21 Apr 2008 19:11:31 -0300, grbgooglefan <[EMAIL PROTECTED]> escribió: On Apr 21, 10:17 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: En Mon, 21 Apr 2008 10:24:15 -0300, grbgooglefan <[EMAIL PROTECTED]> escribió: > I am trying to pass a C++ object to Python function. This Python

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

2008-04-21 Thread grbgooglefan
On Apr 21, 10:17 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Mon, 21 Apr 2008 10:24:15 -0300, grbgooglefan <[EMAIL PROTECTED]> escribió: > > > I am trying to pass a C++ object to Python function. This Python > > function then calls another C++ function which then uses this C++ > > objec

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

2008-04-21 Thread Diez B. Roggisch
Gabriel Genellina wrote: > En Mon, 21 Apr 2008 10:24:15 -0300, grbgooglefan <[EMAIL PROTECTED]> > escribió: > >> 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.

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

2008-04-21 Thread Gabriel Genellina
En Mon, 21 Apr 2008 10:24:15 -0300, grbgooglefan <[EMAIL PROTECTED]> escribió: > 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. > > I tried something like this, bu

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

2008-04-21 Thread Diez B. Roggisch
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 do

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

2008-04-21 Thread grbgooglefan
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. I tried something like this, but it did not work, gave core dump. class myclass { public: myclass(){};