读书人

请教dll中定义了一个包含unsigned cha

发布时间: 2013-07-01 12:33:04 作者: rapoo

请问dll中定义了一个包含unsigned char *类型值的结构体,ctypes中没有对应类型的定义,如何在Python中体现
C
#ifndef HPImage_STRUCT
struct HPImage
{
int width;
int height;
int resolution;
unsigned char * pData;
};
#define HPImage_STRUCT
#endif

Python
class HPImage(Structure):
_fields_ = [('width',c_uint),
('height',c_uint),
('resolution',c_uint),
('pData',????)];

Python问号部分该设置什么类型,ctypes中没有提供这个类型的定义,使用c_ubyte_p会报错
[解决办法]
POINTER(c_ubyte)

读书人网 >perl python

热点推荐