PyDocs

Generic Operating System Services

ctypes

create and manipulate C data types in Python
Symbols in ctypes

_

_CData
This non-public class is the common base class of all ctypes data types.
_CFuncPtr
Function Pointer
_Pointer
Private, abstract base class for pointers.
_SimpleCData
This non-public class is the base class of all fundamental ctypes data types.

a

addressof
Return the address of the C instance internal buffer
alignment
Return the alignment requirements of a C instance
ArgumentError
This exception is raised when a foreign function call cannot convert one of the passed arguments.
Array
Abstract base class for arrays.
ARRAY
Create an array.

b

BigEndianStructure
Structure with big endian byte order
BigEndianUnion
Union with big endian byte order
byref
Return a pointer lookalike to a C instance, only usable as function argument.

c

c_bool
Represent the C bool datatype (more accurately, _Bool from C99).
c_byte
Represents the C signed char datatype, and interprets the value as small integer.
c_char
Represents the C char datatype, and interprets the value as a single character.
c_char_p
Represents the C char* datatype when it points to a zero-terminated string.
c_double
Represents the C double datatype.
c_double_complex
Represents the C double complex datatype, if available.
c_float
Represents the C float datatype.
c_float_complex
Represents the C float complex datatype, if available.
c_int
Represents the C signed int datatype.
c_int16
Represents the C 16-bit signed int datatype.
c_int32
Represents the C 32-bit signed int datatype.
c_int64
Represents the C 64-bit signed int datatype.
c_int8
Represents the C 8-bit signed int datatype.
c_long
Represents the C signed long datatype.
c_longdouble
Represents the C long double datatype.
c_longdouble_complex
Represents the C long double complex datatype, if available.
c_longlong
Represents the C signed long long datatype.
c_short
Represents the C signed short datatype.
c_size_t
Represents the C size_t datatype.
c_ssize_t
Represents the Py_ssize_t datatype.
c_time_t
Represents the C time_t datatype.
c_ubyte
Represents the C unsigned char datatype, it interprets the value as small integer.
c_uint
Represents the C unsigned int datatype.
c_uint16
Represents the C 16-bit unsigned int datatype.
c_uint32
Represents the C 32-bit unsigned int datatype.
c_uint64
Represents the C 64-bit unsigned int datatype.
c_uint8
Represents the C 8-bit unsigned int datatype.
c_ulong
Represents the C unsigned long datatype.
c_ulonglong
Represents the C unsigned long long datatype.
c_ushort
Represents the C unsigned short datatype.
c_void_p
Represents the C void* type.
c_wchar
Represents the C wchar_t datatype, and interprets the value as a single character unicode string.
c_wchar_p
Represents the C wchar_t* datatype, which must be a pointer to a zero-terminated wide character string.
cast
This function is similar to the cast operator in C.
cdll
Creates CDLL instances.
CDLL
An instance of this class represents a loaded dll/shared library, exporting functions using the standard C calling convention (named 'cdecl' on Windows).
CField
Structure/Union member
CFUNCTYPE
CFUNCTYPE(restype, *argtypes, use_errno=False, use_last_error=False) -> function prototype.
COMError
This exception is raised when a COM method call failed.
CopyComPointer
Copies a COM pointer from src to dst and returns the Windows specific HRESULT value.
create_string_buffer
create_string_buffer(aBytes, anInteger) -> character array
create_unicode_buffer
create_unicode_buffer(aString, anInteger) -> character array

d

DEFAULT_MODE
The default mode which is used to load shared libraries.
DllCanUnloadNow
This function is a hook which allows implementing in-process COM servers with ctypes.
DllGetClassObject
This function is a hook which allows implementing in-process COM servers with ctypes.

f

FormatError
Returns a textual description of the error code code.

g

get_errno
Returns the current value of the ctypes-private copy of the system errno variable in the calling thread.
get_last_error
Returns the current value of the ctypes-private copy of the system LastError variable in the calling thread.
GetLastError
Returns the last error code set by Windows in the calling thread.

h

HRESULT
Represents a HRESULT value, which contains success or error information for a function or method call.

l

LibraryLoader
Class which loads shared libraries.
LittleEndianStructure
Structure base class
LittleEndianUnion
Union base class

m

memmove
Same as the standard C memmove library function: copies count bytes from src to dst.
memoryview_at
Return a memoryview representing the memory at void *ptr.
memset
Same as the standard C memset library function: fills the memory block at address dst with count bytes of value c.

o

oledll
Creates OleDLL instances.
OleDLL
See CDLL, the superclass, for common information.

p

pointer
Create a new pointer instance, pointing to 'obj'.
POINTER
Create and return a new ctypes pointer type.
py_object
Represents the C PyObject* datatype.
pydll
Creates PyDLL instances.
PyDLL
This class represents the Python library itself.
PYFUNCTYPE
The returned function prototype creates functions that use the Python calling convention.
pythonapi
An instance of PyDLL that exposes Python C API functions as attributes.

r

resize
This function resizes the internal memory buffer of obj, which must be an instance of a ctypes type.
RTLD_GLOBAL
Flag to use as mode parameter.
RTLD_LOCAL
Flag to use as mode parameter.

s

set_errno
Set the current value of the ctypes-private copy of the system errno variable in the calling thread to value and return the previous value.
set_last_error
Sets the current value of the ctypes-private copy of the system LastError variable in the calling thread to value and return the previous value.
sizeof
Return the size in bytes of a C instance.
string_at
Return the byte string at void *ptr.
Structure
Structure base class

u

Union
Union base class
util.dllist
dllist() return a list of loaded shared libraries
util.find_library
Try to find a library and return a pathname.
util.find_msvcrt
Returns the filename of the VC runtime library used by Python, and by the extension modules.

w

windll
Creates WinDLL instances.
WinDLL
See CDLL, the superclass, for common information.
WinError
Creates an instance of OSError.
WINFUNCTYPE
The returned function prototype creates functions that use the stdcall calling convention.
wstring_at
Return the wide-character string at void *ptr.