I create DLL wrote in C++ , the exporting function returns PyObject * .Then I use ctypes to import the DLL in Python . Now , how can I get the real PyObject ??
here's some part of c++ code:
PyObject* _stdcall getList(){
PyObject * PList = NULL;
PyObject * PItem = NULL;
PList = PyList_New(10);
vector <int> intVector;
int i;
for(int i=0;i<10;i++){
intVector.push_back(i);
}
for(vector<int>::const_iterator it=intVector.begin();it<intVector.end();it++){
PItem = Py_BuildValue("i", &it);
PyList_Append(PList, PItem);
}
return PList;
}
and some python code :
dll = ctypes.windll.LoadLibrary(DllPath)
PList = dll.getList()
*I wanna get the real python list containing 1,2,3,4...10 ? * Am I clear ?? Thanks advance