def __init__(self, block_ptr, restype=None, argtypes=None):
self._block_ptr = block_ptr
self._block = cast(self._block_ptr, POINTER(_Block))
if not argtypes:
argtypes = []
if self._regular_calling_convention():
# First arg is pointer to block, hide it from user
argtypes.insert(0, c_void_p)
if self._has_signature():
# TODO - Validate restype & argtypes against signature
# - Signature is not always populated
pass
self._func = None
if self._regular_calling_convention():
IMPTYPE = CFUNCTYPE(restype, *argtypes)
self._func = IMPTYPE(self._block.contents.invoke)
评论列表
文章目录