PyDocs

Nav

Generic Operating System Services

CDLL

ctypes

class (source)
  • CDLL(name, mode=DEFAULT_MODE, handle=None, use_errno=False, use_last_error=False, winmode=None)
An instance of this class represents a loaded dll/shared
library, exporting functions using the standard C calling
convention (named 'cdecl' on Windows).

The exported functions can be accessed as attributes, or by
indexing with the function name.  Examples:

<obj>.qsort -> callable object
<obj>['qsort'] -> callable object

Calling the functions releases the Python GIL during the call and
reacquires it afterwards.
Changed in 3.8, 3.12
  • 3.8: Added winmode parameter.
  • 3.12: The name parameter can now be a path-like object.
Members of CDLL

_

_handle
The system handle used to access the library.
_name
The name of the library passed in the constructor.
1 Example
>>> printf = ctypes.CDLL(None).printf
>>> printf.argtypes = [ctypes.c_char_p]
>>> printf(b"hello\n")
hello
6
from the Python docs
See Also
No see-alsos for ctypes/CDLL
0 Notes
No notes for CDLL