What is the ctypes.c_ulonglong type in Python?
ctypes.c_ulonglong maps to the C unsigned long long, a 64-bit unsigned integer from 0 to 18,446,744,073,709,551,615, and is the same size on every platform.
Spread Your Knowledge. Questions with answers, tutorials and articles, newest first.
ctypes.c_ulonglong maps to the C unsigned long long, a 64-bit unsigned integer from 0 to 18,446,744,073,709,551,615, and is the same size on every platform.
ctypes.c_longlong maps the C long long to Python as a 64-bit signed integer. See usage, overflow behaviour and how it differs from c_long.
ctypes.c_ulong maps to the C unsigned long. It is 64 bits on 64-bit Linux and macOS but only 32 bits on Windows, and out-of-range values wrap silently.
ctypes.c_long maps the C long, which is 64 bits on Linux and macOS but 32 bits on Windows. Learn how to use it safely across platforms.
ctypes.c_uint maps to the C unsigned int, usually 32 bits. It wraps on overflow instead of raising, and works in function calls, structures and arrays.
ctypes.c_int maps the C int to Python. Learn the 32-bit range, default restype behaviour, byref output parameters and related integer types.
ctypes.c_ushort maps to the C unsigned short, a 16-bit type holding 0 to 65,535. Learn calls, structures, arrays and overflow behaviour.
ctypes.c_short wraps a signed C short integer. See its range, how overflow wraps, and how to use it in arrays, structures and C function calls.
ctypes.c_ubyte is an unsigned 8-bit integer. See its range, how it wraps, and how to use it for byte arrays, structures and shared buffers.
ctypes.c_byte represents a signed 8-bit C integer, signed char, holding -128 to 127. Values outside that range silently wrap around without raising an error.
How c_wchar arrays and create_unicode_buffer model wide strings in ctypes, why wchar_t is 2 bytes on Windows and 4 elsewhere, and the errors to expect.
ctypes.c_wchar maps the C wchar_t type to a one-character Python string, with examples of passing wide characters to C and the Windows versus Linux size difference.
ctypes.c_char represents a single C char as one byte. See how it differs from c_char_p, how to use char arrays, and how to put it in structures.
ctypes.py_object represents a PyObject pointer. See how to read values, call the Python C API through pythonapi and avoid common crashes.
ctypes.cdll loads shared libraries that use the cdecl calling convention on any platform, so you can call C functions from Python without an extension module.
ctypes.windll opens Windows DLLs and calls their stdcall functions. It exists only on Windows and needs declared argument and return types.
ctypes.wintypes defines the Windows API types (DWORD, HANDLE, HWND, POINT) so you can call Windows DLL functions from Python with correct signatures.
ctypes.util.find_library finds a shared library by short name so ctypes.CDLL can load it. See platform behaviour, None handling and portable loading.
The ctypes module loads shared libraries and builds C data types from Python. See CDLL, argtypes, restype, structures, callbacks and when to use cffi instead.
Python's queue module provides thread-safe FIFO, LIFO and priority queues for producer-consumer programs. Learn the classes, methods and when to use them.