_lib._ccallback

Module Contents

Classes

Functions

class CData
_import_cffi()
class LowLevelCallable

Low-level callback function.

function : {PyCapsule, ctypes function pointer, cffi function pointer}
Low-level callback function.
user_data : {PyCapsule, ctypes void pointer, cffi void pointer}
User data to pass on to the callback function.
signature : str, optional
Signature of the function. If omitted, determined from function, if possible.
function
Callback function given
user_data
User data given
signature
Signature of the function.
from_cython
Class method for constructing callables from Cython C-exported functions.

The argument function can be one of:

  • PyCapsule, whose name contains the C function signature
  • ctypes function pointer
  • cffi function pointer

The signature of the low-level callback must match one of those expected by the routine it is passed to.

If constructing low-level functions from a PyCapsule, the name of the capsule must be the corresponding signature, in the format:

return_type (arg1_type, arg2_type, ...)

For example:

"void (double)"
"double (double, int *, void *)"

The context of a PyCapsule passed in as function is used as user_data, if an explicit value for user_data was not given.

__new__(function, user_data=None, signature=None)
__repr__()
function()
user_data()
signature()
__getitem__(idx)
from_cython(module, name, user_data=None, signature=None)

Create a low-level callback function from an exported Cython function.

module : module
Cython module where the exported function resides
name : str
Name of the exported function
user_data : {PyCapsule, ctypes void pointer, cffi void pointer}, optional
User data to pass on to the callback function.
signature : str, optional
Signature of the function. If omitted, determined from function.
_parse_callback(obj, user_data=None, signature=None)
_get_ctypes_func(func, signature=None)
_typename_from_ctypes(item)
_get_ctypes_data(data)
_get_cffi_func(func, signature=None)
_get_cffi_data(data)