Hi all,
I'm trying to wrap my head around the ctypes API. I have a C structure I
wish to create in Python and then return from python to C.
So a python method is called from C and needs to return an object which
we then process in C again.
I have a binding to access and create the C methods and structures so in
Python I can call the Zmsg() constructor. I now need to return this.
My python test method is simply:
def actor_test( *args, **kwargs):
print("test")
msg = Zmsg()
frame = Zframe(b"Hello", 5)
msg.prepend(frame)
return msg
the method is called from C as follows:
PyObject *pReturn = PyObject_CallObject(pFunc, NULL);
This correctly calls the method. However the returned object is of
course a PyObject*. The debugger says it's
"<czmq._czmq_ctypes.Zmsg object at 0x7ffff5f18e50>" PyObject
[class] "<class 'czmq._czmq_ctypes.Zmsg'>"
[super class] "<class 'object'>"
[meta type] "<class 'type'>"
ob_refcnt 1 Py_ssize_t
However how I can I get it back to the original C type (zmsg_t *)
Any help really appreciated.
Rg,
Arnaud
--
https://mail.python.org/mailman/listinfo/python-list