On this page
ctypes.c_long
Prev: ctypes.c_int8 | Up: ctypes | Next: ctypes.c_longdouble
Rel: ctypes.addressof, ctypes.alignment, ctypes.ArgumentError, ctypes.Array
Ref: docs.python.org — ctypes.c_long
Tags: #public #python3 #stdlib #ctypes
Import
import ctypes
from ctypes import c_long
Signature & Overview
ctypes.c_long(...)
ctypes.c_long class.
Usage
import ctypes
n = ctypes.c_long(123)
assert n.value == 123
Gotchas
- Size differs by OS: 4 bytes on 64-bit Windows (LLP64), 8 bytes on 64-bit Linux/macOS (LP64)—use
c_int32/c_int64for fixed widths.
REPL Inspect
from ctypes import c_long
help(c_long)
Linked from
Related notes
- tuts/python3/stdlib_module/ctypes/c_int8 Linked here; links to this page; shared tags: #ctypes, #stdlib
- tuts/python3/stdlib_module/ctypes/c_longdouble Linked here; links to this page; shared tags: #ctypes, #stdlib
- tuts/python3/stdlib_module/ctypes Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/ctypes/addressof Linked here; shared tags: #ctypes, #stdlib
- tuts/python3/stdlib_module/ctypes/alignment Linked here; shared tags: #ctypes, #stdlib
- tuts/python3/stdlib_module/ctypes/ArgumentError Linked here; shared tags: #ctypes, #stdlib
- tuts/python3/stdlib_module/ctypes/Array Linked here; shared tags: #ctypes, #stdlib
- tuts/python3/stdlib_module/ctypes/BigEndianStructure shared tags: #ctypes, #stdlib
- tuts/python3/stdlib_module/ctypes/BigEndianUnion shared tags: #ctypes, #stdlib
- tuts/python3/stdlib_module/ctypes/byref shared tags: #ctypes, #stdlib