Passing python objects as arguments to C/C++ function using ctypes
问题 I have a dll with a function that takes PyObject as argument something like void MyFunction(PyObject* obj) { PyObject *func, *res, *test; //function getAddress of python object func = PyObject_GetAttrString(obj, "getAddress"); res = PyObject_CallFunction(func, NULL); cout << "Address: " << PyString_AsString( PyObject_Str(res) ) << endl; } and I want to call this function in the dll from python using ctypes My python code looks like import ctypes as c path = "h:\libTest" libTest = c.cdll