libretro.ctypes

Type annotations for ctypes behavior that is documented but missing from its type stubs.

Most of these definitions fall back to standard ctypes types at runtime; this allows them to be used as drop-in replacements for the standard types in function signatures.

Module Attributes

CBoolArg

A type that can be used as an argument for a C c_bool parameter.

CIntArg

A type that can be used as an argument for a C integer parameter.

CFloatArg

A type that can be used as an argument for a C floating-point parameter.

CStringArg

A type that can be used as an argument for a C char * parameter.

Classes

AsParameter

A type that can be converted to a ctypes object with the _as_parameter_ property.

CFloatArg

A type that can be used as an argument for a C floating-point parameter.

CIntArg

A type that can be used as an argument for a C integer parameter.

Pointer

TypedFunctionPointer

TypedPointer

c_void_ptr

A trivial subclass of c_void_p that solely exists to prevent ctypes from implicitly converting void* parameters or struct fields to an int.

class AsParameter[source]

Bases: Protocol, Generic

A type that can be converted to a ctypes object with the _as_parameter_ property.

__init__(*args, **kwargs)
classmethod __new__(*args, **kwargs)
type ConvertibleTo = T | AsParameter
CBoolArg

A type that can be used as an argument for a C c_bool parameter.

CFloatArg

A type that can be used as an argument for a C floating-point parameter.

CIntArg

A type that can be used as an argument for a C integer parameter.

CStringArg

A type that can be used as an argument for a C char * parameter.

TypedFunctionPointer[source]

alias of _FunctionPointerDeclaration

Pointer

alias of _PointerDeclaration

TypedPointer[source]

alias of _PointerDeclaration

TypedArray

alias of Array

class c_void_ptr[source]

Bases: c_void_p

A trivial subclass of c_void_p that solely exists to prevent ctypes from implicitly converting void* parameters or struct fields to an int.

Use this in function signatures and struct definitions instead of c_void_p.

__init__(*args, **kwargs)
classmethod __new__(*args, **kwargs)
classmethod from_param(value, /)
value