ctypes

create and manipulate C data types in Python

Functions

ARRAY(typ, len)
CFUNCTYPE(restype, *argtypes, **kw) CFUNCTYPE(restype, *argtypes, use_errno=False, use_last_error=False) -> function prototype.
POINTER
PYFUNCTYPE(restype, *argtypes)
SetPointerType(pointer, cls)
addressof((C instance) -> integer) Return the address of the C instance internal buffer
alignment((C type) -> integer) alignment(C instance) -> integer
byref((C instance[[, offset]) Return a pointer lookalike to a C instance, only usable
c_buffer(init[, size])
cast(obj, typ)
create_string_buffer(...) create_string_buffer(anInteger) -> character array
create_unicode_buffer(...) create_unicode_buffer(anInteger) -> character array
get_errno
pointer
resize Resize the memory buffer of a ctypes instance
set_conversion_mode(encoding, ...) Set the encoding and error handling ctypes uses when converting between unicode and strings.
set_errno
sizeof((C type) -> integer) sizeof(C instance) -> integer
string_at((addr[, size]) -> string) Return the string at addr.
wstring_at((addr[, size]) -> string) Return the string at addr.

Classes

Array XXX to be provided
BigEndianStructure Structure with big endian byte order
CDLL(name[, mode, handle, use_errno, ...]) An instance of this class represents a loaded dll/shared library, exporting functions using the standard C calling convention (named ‘cdecl’ on Windows).
LibraryLoader(dlltype)
LittleEndianStructure alias of Structure
PyDLL(name[, mode, handle, use_errno, ...]) This class represents the Python library itself.
Structure Structure base class
Union Union base class
c_bool
c_byte
c_char
c_char_p
c_double
c_float
c_int
c_int16 alias of c_short
c_int32 alias of c_int
c_int64 alias of c_long
c_int8 alias of c_byte
c_long
c_longdouble
c_longlong alias of c_long
c_short
c_size_t alias of c_ulong
c_ssize_t alias of c_long
c_ubyte
c_uint
c_uint16 alias of c_ushort
c_uint32 alias of c_uint
c_uint64 alias of c_ulong
c_uint8 alias of c_ubyte
c_ulong
c_ulonglong alias of c_ulong
c_ushort
c_void_p
c_voidp alias of c_void_p
c_wchar
c_wchar_p
py_object

Exceptions

ArgumentError