Back to index

python3.2  3.2.2
Public Member Functions | Public Attributes | Private Attributes | Static Private Attributes
ctypes.CDLL Class Reference
Inheritance diagram for ctypes.CDLL:
Inheritance graph
[legend]
Collaboration diagram for ctypes.CDLL:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def __repr__
def __getattr__
def __getitem__

Public Attributes

_PyObject_HEAD_EXTRA Py_ssize_t ob_refcnt
struct _typeobjectob_type

Private Attributes

 _name
 _FuncPtr
 _handle

Static Private Attributes

 _func_flags_ = _FUNCFLAG_CDECL
 _func_restype_ = c_int

Detailed Description

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.

Definition at line 307 of file __init__.py.


Constructor & Destructor Documentation

def ctypes.CDLL.__init__ (   self,
  name,
  mode = DEFAULT_MODE,
  handle = None,
  use_errno = False,
  use_last_error = False 
)

Definition at line 326 of file __init__.py.

00326 
00327                  use_last_error=False):
00328         self._name = name
00329         flags = self._func_flags_
00330         if use_errno:
00331             flags |= _FUNCFLAG_USE_ERRNO
00332         if use_last_error:
00333             flags |= _FUNCFLAG_USE_LASTERROR
00334 
00335         class _FuncPtr(_CFuncPtr):
00336             _flags_ = flags
00337             _restype_ = self._func_restype_
00338         self._FuncPtr = _FuncPtr
00339 
00340         if handle is None:
00341             self._handle = _dlopen(self._name, mode)
00342         else:
00343             self._handle = handle

Here is the caller graph for this function:


Member Function Documentation

def ctypes.CDLL.__getattr__ (   self,
  name 
)

Reimplemented in ctypes.test.test_cfuncs.stdcall_dll.

Definition at line 350 of file __init__.py.

00350 
00351     def __getattr__(self, name):
00352         if name.startswith('__') and name.endswith('__'):
00353             raise AttributeError(name)
00354         func = self.__getitem__(name)
00355         setattr(self, name, func)
00356         return func

Here is the call graph for this function:

def ctypes.CDLL.__getitem__ (   self,
  name_or_ordinal 
)

Definition at line 357 of file __init__.py.

00357 
00358     def __getitem__(self, name_or_ordinal):
00359         func = self._FuncPtr((name_or_ordinal, self))
00360         if not isinstance(name_or_ordinal, int):
00361             func.__name__ = name_or_ordinal
00362         return func

Here is the caller graph for this function:

def ctypes.CDLL.__repr__ (   self)

Definition at line 344 of file __init__.py.

00344 
00345     def __repr__(self):
00346         return "<%s '%s', handle %x at %x>" % \
00347                (self.__class__.__name__, self._name,
00348                 (self._handle & (_sys.maxsize*2 + 1)),
00349                 id(self) & (_sys.maxsize*2 + 1))


Member Data Documentation

ctypes.CDLL._func_flags_ = _FUNCFLAG_CDECL [static, private]

Reimplemented in ctypes.OleDLL, ctypes.WinDLL, and ctypes.PyDLL.

Definition at line 321 of file __init__.py.

ctypes.CDLL._func_restype_ = c_int [static, private]

Reimplemented in ctypes.OleDLL.

Definition at line 322 of file __init__.py.

Definition at line 337 of file __init__.py.

Definition at line 340 of file __init__.py.

ctypes.CDLL._name [private]

Definition at line 327 of file __init__.py.

Definition at line 107 of file object.h.

struct _typeobject* _object::ob_type [inherited]

Definition at line 108 of file object.h.


The documentation for this class was generated from the following file: