我的头文件中有以下代码:
typedef struct
{
void *Handle;
} RESHANDLE, *PRESHANDLE;
如何在ctypes(Python)中描述结构?
从
ctypes.Structure
派生结构并声明结构成员名称和类型,如下所示:
import ctypes as ct
class RESHANDLE(ct.Structure):
_fields_ = ('Handle', ct.c_void_p),
PRESHANDLE = ct.POINTER(RESHANDLE)