Package ctypes
[hide private]
[frames] | no frames]

Package ctypes

source code

create and manipulate C data types in Python


Version: 1.0.2

Classes [hide private]
  ArgumentError
  CDLL
An instance of this class represents a loaded dll/shared library, exporting functions using the standard C calling convention (named 'cdecl' on Windows).
  HRESULT
  LibraryLoader
  OleDLL
This class represents a dll exporting functions using the Windows stdcall calling convention, and returning HRESULT.
  PyDLL
This class represents the Python library itself.
  WinDLL
This class represents a dll exporting functions using the Windows stdcall calling convention.
  c_byte
  c_char
  c_char_p
  c_double
  c_float
  c_int
  c_int16
  c_int32
  c_int64
  c_int8
  c_long
  c_longlong
  c_short
  c_size_t
  c_ubyte
  c_uint
  c_uint16
  c_uint32
  c_uint64
  c_uint8
  c_ulong
  c_ulonglong
  c_ushort
  c_void_p
  c_voidp
  c_wchar
  c_wchar_p
  py_object
Functions [hide private]
 
ARRAY(typ, len) source code
 
CFUNCTYPE(restype, *argtypes)
restype: the result type argtypes: a sequence specifying the argument types
source code
 
DllCanUnloadNow() source code
 
DllGetClassObject(rclsid, riid, ppv) source code
 
POINTER(cls) source code
 
PYFUNCTYPE(restype, *argtypes) source code
 
SetPointerType(pointer, cls) source code
 
WINFUNCTYPE(restype, *argtypes) source code
 
WinError(code=None, descr=None) source code
 
_check_size(typ, typecode=None) source code
 
c_buffer(init, size=None) source code
 
cast(obj, typ) source code
 
create_string_buffer(aString)
create_string_buffer(anInteger) -> character array create_string_buffer(aString, anInteger) -> character array
source code
 
create_unicode_buffer(aString)
create_unicode_buffer(anInteger) -> character array create_unicode_buffer(aString, anInteger) -> character array
source code
 
pointer(inst) source code
 
string_at(addr, size=...)
Return the string at addr.
source code
 
wstring_at(addr, size=...)
Return the string at addr.
source code
Variables [hide private]
  DEFAULT_MODE = 0
  GetLastError = <_FuncPtr object at 0x00FBEF30>
  RTLD_GLOBAL = 0
  RTLD_LOCAL = 0
  _FUNCFLAG_CDECL = 1
  _FUNCFLAG_PYTHONAPI = 4
  _FUNCFLAG_STDCALL = 0
  _c_functype_cache = {(None, ()): <class 'ctypes.CFunctionType'...
  _cast = <CFunctionType object at 0x0109E120>
  _cast_addr = 488266112
  _ctypes_version = '1.0.2'
  _memmove_addr = 2083793294
  _memset_addr = 488291326
  _pointer_type_cache = {None: <class 'ctypes.c_void_p'>, <class...
  _string_at = <CFunctionType object at 0x0109E198>
  _string_at_addr = 488265824
  _win_functype_cache = {}
  _wstring_at = <CFunctionType object at 0x0109E210>
  _wstring_at_addr = 488268064
  cdll = <ctypes.LibraryLoader object at 0x01095E50>
  memmove = <CFunctionType object at 0x0109E030>
  memset = <CFunctionType object at 0x0109E0A8>
  oledll = <ctypes.LibraryLoader object at 0x01095ED0>
  pydll = <ctypes.LibraryLoader object at 0x01095E70>
  pythonapi = <PyDLL 'python dll', handle 1e000000 at 1095e90>
  windll = <ctypes.LibraryLoader object at 0x01095EB0>
Function Details [hide private]

CFUNCTYPE(restype, *argtypes)

source code 

restype: the result type argtypes: a sequence specifying the argument types

The function prototype can be called in different ways to create a callable object:

prototype(integer address) -> foreign function prototype(callable) -> create and return a C callable function from callable prototype(integer index, method name[, paramflags]) -> foreign function calling a COM method prototype((ordinal number, dll object)[, paramflags]) -> foreign function exported by ordinal prototype((function name, dll object)[, paramflags]) -> foreign function exported by name

Returns:
function prototype

create_string_buffer(aString)

source code 
create_string_buffer(anInteger) -> character array create_string_buffer(aString, anInteger) -> character array
Returns:
character array

create_unicode_buffer(aString)

source code 
create_unicode_buffer(anInteger) -> character array create_unicode_buffer(aString, anInteger) -> character array
Returns:
character array

string_at(addr, size=...)

source code 
Return the string at addr.
Returns:
string

wstring_at(addr, size=...)

source code 
Return the string at addr.
Returns:
string


Variables Details [hide private]

_c_functype_cache

Value:
{(None, ()): <class 'ctypes.CFunctionType'>,
 (None,
  (<pycv.interfaces.opencv.CVtypes.ByRefArg object at 0x02695830>)): <\
class 'ctypes.CFunctionType'>,
 (None,
  (<pycv.interfaces.opencv.CVtypes.ByRefArg object at 0x026958D0>)): <\
class 'ctypes.CFunctionType'>,
 (None, (<pycv.interfaces.opencv.CVtypes.ByRefArg object at 0x02695B30\
...

_pointer_type_cache

Value:
{None: <class 'ctypes.c_void_p'>,
 <class 'ctypes.c_ubyte'>: <class 'ctypes.LP_c_ubyte'>,
 <class 'ctypes.c_byte'>: <class 'ctypes.LP_c_byte'>,
 <class 'ctypes.c_char'>: <class 'ctypes.LP_c_char'>,
 <class 'ctypes.c_char_p'>: <class 'ctypes.LP_c_char_p'>,
 <class 'ctypes.c_void_p'>: <class 'ctypes.LP_c_void_p'>,
 <class 'ctypes.c_wchar'>: <class 'ctypes.LP_c_wchar'>,
 <class 'ctypes.c_short'>: <class 'ctypes.LP_c_short'>,
...