我在标题im wrapping中有一个函数

IMPORT_FUNCTION int WINAPI GetStuff(int id, StuffStruct* stuff, StuffList *stuffList=NULL);

我用包装此函数
mydll.GetStuff.argtypes = [c_int, POINTER(StuffStruct), POINTER(StuffList)]

也试过跳过
mydll.GetStuff.argtypes = [c_int, POINTER(StuffStruct)]

我需要调用这个函数而不指定最后一个参数我没有尝试过,创建了一个空指针,就像这个指针(StuffList)一样()
我觉得我应该使用原型,但现在我不知道。
stuff = StuffStruct()
np = POINTER(StuffList)()
mydll.GetStuff(2, byref(stuff), None) # tried this
mydll.GetStuff(2, byref(stuff), np) # tried this
mydll.GetStuff(2, byref(stuff)) # tried this

最佳答案

尝试:

mydll.GetStuff(2, byref(stuff), byref(0))


mydll.GetStuff(2, byref(stuff), byref(None))


np = POINTER([])

10-08 02:37