首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > perl python >

请教dll中定义了一个包含unsigned char *类型值的结构体,ctypes中没有对应类型的定义,怎么在Python中体现

2013-07-01 
请问dll中定义了一个包含unsigned char *类型值的结构体,ctypes中没有对应类型的定义,如何在Python中体现C

请问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)

热点排行