Python python ctypes 提取 char**值

phoenix · 2019年10月15日 · 1473 次阅读

1、需要通过 python ctypes 注册个结构体,提取 C 函数指针的值
2、C 中结构体如下
struct cbChatQueryAllCreatedTeams_T
{
enum { iEvtType = enNplChat + 27 };
uint32_t teamCount;
char** teamIds;
};
3、python 中映射如下
class struct_cbChatTeamAllMembersInfo_t(Structure):
seq = enNplChat + 29
pack = 4
fields = [("teamId",c_char*256),("memberCount",c_uint32),("members",POINTER(c_void_p))]
4、实际执行过程中报了 ValueError: NULL pointer access
5、我是个 python 新手,谁能告诉我 char** 在 ctypes 中这样注册,是否是正确的?或者应该如何写?

暂无回复。
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册