Utils

class ctyped.utils.ErrorInfo(num, code, msg)

Create new instance of ErrorInfo(num, code, msg)

code

Alias for field number 1

msg

Alias for field number 2

num

Alias for field number 0

class ctyped.utils.FuncInfo(name_py, name_c, annotations, options)

Create new instance of FuncInfo(name_py, name_c, annotations, options)

annotations

Alias for field number 2

name_c

Alias for field number 1

name_py

Alias for field number 0

options

Alias for field number 3

ctyped.utils.c_callback(use_errno: bool = False) → Callable

Decorator to turn a Python function into a C callback function.

@lib.f
def c_func_using_callback(hook: CPointer) -> int:
    ...

@c_callback
def hook(num: int) -> int:
    return num + 10

c_func_using_callback(hook)
Parameters:use_errno
ctyped.utils.get_last_error() → ctyped.utils.ErrorInfo

Returns last error (errno) information named tuple:

(err_no, err_code, err_message)