def WINFUNCTYPE(restype, *argtypes, **kw):
flags = _FUNCFLAG_STDCALL
if kw.pop("use_errno", False):
flags |= ctypes._FUNCFLAG_USE_ERRNO
if kw.pop("use_last_error", False):
flags |= ctypes._FUNCFLAG_USE_LASTERROR
if kw:
raise ValueError("unexpected keyword argument(s) %s" % kw.keys())
try:
return ctypes._win_functype_cache[(restype, argtypes, flags)]
except KeyError:
class WinFunctionType(ctypes._CFuncPtr):
_argtypes_ = argtypes
_restype_ = restype
_flags_ = flags
ctypes._win_functype_cache[(restype, argtypes, flags)] = WinFunctionType
return WinFunctionType
评论列表
文章目录