Beispiel #1
0
 def __init__(self, argtypes, restype, func, additional_arg=0, flags=FUNCFLAG_CDECL):
     AbstractFuncPtr.__init__(self, "callback", argtypes, restype, flags)
     self.ll_closure = closureHeap.alloc()
     self.ll_userdata = lltype.malloc(USERDATA_P.TO, flavor="raw", track_allocation=False)
     self.ll_userdata.callback = rffi.llhelper(CALLBACK_TP, func)
     self.ll_userdata.addarg = additional_arg
     res = c_ffi_prep_closure(self.ll_closure, self.ll_cif, ll_callback, rffi.cast(rffi.VOIDP, self.ll_userdata))
     if not res == FFI_OK:
         raise OSError(-1, "Unspecified error calling ffi_prep_closure")
Beispiel #2
0
 def __init__(self, argtypes, restype, func, additional_arg=0):
     AbstractFuncPtr.__init__(self, "callback", argtypes, restype)
     self.ll_closure = lltype.malloc(FFI_CLOSUREP.TO, flavor='raw')
     self.ll_userdata = lltype.malloc(USERDATA_P.TO, flavor='raw')
     self.ll_userdata.callback = rffi.llhelper(CALLBACK_TP, func)
     self.ll_userdata.addarg = additional_arg
     res = c_ffi_prep_closure(self.ll_closure, self.ll_cif,
                              ll_callback, rffi.cast(rffi.VOIDP,
                                                     self.ll_userdata))
     if not res == FFI_OK:
         raise OSError(-1, "Unspecified error calling ffi_prep_closure")
Beispiel #3
0
 def __init__(self, argtypes, restype, func, additional_arg=0,
              flags=FUNCFLAG_CDECL):
     AbstractFuncPtr.__init__(self, "callback", argtypes, restype, flags)
     self.ll_closure = closureHeap.alloc()
     self.ll_userdata = lltype.malloc(USERDATA_P.TO, flavor='raw')
     self.ll_userdata.callback = rffi.llhelper(CALLBACK_TP, func)
     self.ll_userdata.addarg = additional_arg
     res = c_ffi_prep_closure(self.ll_closure, self.ll_cif,
                              ll_callback, rffi.cast(rffi.VOIDP,
                                                     self.ll_userdata))
     if not res == FFI_OK:
         raise OSError(-1, "Unspecified error calling ffi_prep_closure")
def _get_api_ptr():
    api_ptr = rffi.make(api_type)
    for fn_name, fn, fn_ll_type, _, _ in _API_FUNCS_iterable:
        setattr(api_ptr, fn_name, rffi.llhelper(fn_ll_type, fn))
    return api_ptr
def _get_api_ptr():
    api_ptr = rffi.make(api_type)
    for fn_name, fn, fn_ll_type, _, _ in _API_FUNCS_iterable:
        setattr(api_ptr, fn_name, rffi.llhelper(fn_ll_type, fn))
    return api_ptr