c++ header file code:
typedef int TSecurityFtdcErrorIDType;
typedef char TSecurityFtdcErrorMsgType[81];
struct CSecurityFtdcRspInfoField
{
TSecurityFtdcErrorIDType ErrorID;
TSecurityFtdcErrorMsgType ErrorMsg;
};
c++ class header :
class CSecurityFtdcMdSpi
{
public:
virtual void OnRspError(CSecurityFtdcRspInfoField *pRspInfo, int nRequestID, bool bIsLast) {};
}
my pxd define:
ctypedef int TSecurityFtdcErrorIDType
ctypedef char TSecurityFtdcErrorMsgType[81]
cdef struct CSecurityFtdcRspInfoField:
TSecurityFtdcErrorIDType ErrorID
TSecurityFtdcErrorMsgType ErrorMsg
cython class define pxd:
cdef cppclass CSecurityFtdcMdSpi:
void OnRspError(CSecurityFtdcRspInfoField *pRspInfo,
int nRequestID,
bool bIsLast) except +
if I try to define class in pyx files:
cdef class CSecurityMdSpi:
cdef CSecurityFtdcMdSpi *_this_md_spi
cpdef OnRspError(self, CSecurityFtdcRspUserLoginField *pRspInfo,
int nRequestID,
bool bIsLast) except +:
self._this_md_spi.OnRspError(pRspInfo, nRequestID, bIsLast)
but when I try to compile the code , console output:
Cannot convert 'CSecurityFtdcRspInfoField *' to Python object
How could I convert the c++ struct in python , how to declare the struct parameter in cython , use cdef
function or else?