want to get the pointer of any python object in C++, but I Failed.
lg2779 at sina.com
lg2779 at sina.com
Sun Dec 4 05:25:09 EST 2005
Hello all
I am trying to call the method of python object. But I dont know
how to transfer the pointer of the python object into c++ .
the C++ method to receive python object pointer :
static PyObject*
ReceivePythonPointer(PyObject* self, PyObject* args)
{
PyObject* temp=NULL ;
//translate into C++ pointer, but Failed, the temp is null
if ( PyArg_ParseTuple(args, "0", &tmp) )
{
//tmp
}
}
to call c method in the following python script:
class foo:
def __init__(self):
ReceivePythonPointer(self)
def Func(self):
print 'Func'
f1 foo
Is it impossible to get the pointer of C object when
ReceviePythonPointer is Called?
I want to get the pointer of "f1" object, Can you give me some advice ?
Best wishes.
More information about the Python-list
mailing list