我的 C 代码返回一个指向结构的指针,这就是我在python
class CONTEXT(ctypes.Structure):
_fields_ = [
("sockfd", ctypes.c_int),
("eidSeq", ctypes.c_longlong)
]
# API
# connect
PY_connect=NativeDll.gf_connect
# connect input and output parameter declaration
PY_connect.argtype = [
ctypes.c_char_p,
ctypes.c_char_p,
ctypes.POINTER(ctypes.c_int)
]
PY_connect.restype = [
ctypes.POINTER(CONTEXT)
]
但我收到以下错误restype
TypeError: restype must be a type, a callable, or None