All Samples(1075) | Call(464) | Derive(1) | Import(610)
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.
src/q/u/Quotient-0.3.0/xquotient/dspam.py Quotient(Download)
# -*- test-case-name: xquotient.test.test_dspam -*- from ctypes import CDLL, Structure, c_char_p, c_float, c_long, c_char from ctypes import c_ulonglong, c_int, c_uint, c_void_p, POINTER from ctypes import SetPointerType, RTLD_GLOBAL import os, time STORAGE_DRIVER="/usr/lib/dspam/libhash_drv.so"
def loadLibDSPAM(storageDriver, libName=DSPAM_LIB):
if not os.path.exists(libName):
raise RuntimeError("DSPAM library not found")
if not os.path.exists(storageDriver):
raise RuntimeError("DSPAM storage driver %s not found" % (storageDriver,))
d = CDLL(libName, mode=RTLD_GLOBAL)
d.dspam_create.restype = POINTER(DSPAM_CTX)
src/p/y/pyudev-HEAD/pyudev/_libudev.py pyudev(Download)
""" from ctypes import CDLL, Structure, POINTER, c_char_p, c_int, get_errno from ctypes.util import find_library
Important functions are given proper signatures and return types to
support type checking and argument conversion.
"""
libudev = CDLL(find_library('udev'), use_errno=True)
# context function signature
for namespace, members in SIGNATURES.items():
for funcname, signature in members.items():
src/p/y/pyudev-0.6/pyudev/_libudev.py pyudev(Download)
""" from ctypes import CDLL, Structure, POINTER, c_char_p, c_int, get_errno from ctypes.util import find_library
Important functions are given proper signatures and return types to
support type checking and argument conversion.
"""
libudev = CDLL(find_library('udev'), use_errno=True)
# context function signature
for namespace, members in SIGNATURES.items():
for funcname, signature in members.items():
src/r/o/rox-HEAD/System/top.py rox(Download)
import rox, os
try:
from ctypes import CDLL
except ImportError:
rox.croak('The ctypes python module could not be imported.\n'
'Is it installed? You can get it from here:\n\n'
try:
try:
try:
libgtop = CDLL('libgtop-2.0.so.7')
top_version = (2, 7)
except:
libgtop = CDLL('libgtop-2.0.so.5')
top_version = (2, 5)
except OSError:
libgtop = CDLL('libgtop-2.0.so')
version=0
except:
version=2
glib=CDLL('libglib-2.0.so')
def glibtop_free_r(ignored, ptr):
glib.g_free(ptr)
src/p/a/pam-0.1.4/pam.py pam(Download)
"""
__all__ = ['authenticate']
from ctypes import CDLL, POINTER, Structure, CFUNCTYPE, cast, pointer, sizeof
from ctypes import c_void_p, c_uint, c_char_p, c_char, c_int
from ctypes.util import find_library
LIBPAM = CDLL(find_library("pam"))
LIBC = CDLL(find_library("c"))
src/s/h/shapely-HEAD/shapely/geos.py shapely(Download)
import time import threading import ctypes from ctypes import cdll, CDLL, PyDLL, CFUNCTYPE, c_char_p, c_void_p, string_at from ctypes.util import find_library from ctypes_declarations import prototype
def load_dll(libname, fallbacks=None):
lib = find_library(libname)
if lib is not None:
return CDLL(lib)
else:
if fallbacks is not None:
for name in fallbacks:
try:
return CDLL(name)
wininst_dlls = os.path.abspath(os.__file__ + "../../../DLLs")
original_path = os.environ['PATH']
os.environ['PATH'] = "%s;%s;%s" % (egg_dlls, wininst_dlls, original_path)
_lgeos = CDLL("geos.dll")
except (ImportError, WindowsError, OSError):
raise
def free(m):
src/s/h/Shapely-1.2.5/shapely/geos.py Shapely(Download)
import time import threading import ctypes from ctypes import cdll, CDLL, PyDLL, CFUNCTYPE, c_char_p, c_void_p, string_at from ctypes.util import find_library from ctypes_declarations import prototype
def load_dll(libname, fallbacks=None):
lib = find_library(libname)
if lib is not None:
return CDLL(lib)
else:
if fallbacks is not None:
for name in fallbacks:
try:
return CDLL(name)
local_dlls = os.path.abspath(os.__file__ + "../../../DLLs")
original_path = os.environ['PATH']
os.environ['PATH'] = "%s;%s" % (local_dlls, original_path)
_lgeos = CDLL("geos.dll")
except (ImportError, WindowsError, OSError):
raise
def free(m):
src/p/y/python-gnutls-1.2.0/gnutls/library/__init__.py python-gnutls(Download)
def load_library(name, version):
from ctypes import CDLL
for library in library_locations(name, version):
try:
return CDLL(library)
except OSError:
system = get_system_name()
if system == 'windows':
from ctypes import CDLL, FormatError, POINTER, byref, create_unicode_buffer, c_wchar_p, sizeof, windll
from ctypes.wintypes import BOOL, DWORD, HANDLE, HMODULE
GetCurrentProcess = windll.kernel32.GetCurrentProcess
if EnumProcessModules(GetCurrentProcess(), module_handles, sizeof(module_handles), byref(needed)):
for i in xrange(needed.value / sizeof(HMODULE)):
if GetModuleFileName(module_handles[i], module_name, len(module_name)) and 'libgcrypt' in module_name.value:
libgcrypt = CDLL(module_name.value)
break
else:
raise RuntimeError('cannot find libgcrypt among the loaded dlls')
src/c/0/c.seungjin.net-HEAD/lib/python2.5/site-packages/django/contrib/gis/geos/prototypes/errcheck.py c.seungjin.net(Download)
""" Error checking functions for GEOS ctypes prototype functions. """ import os from ctypes import c_void_p, string_at, CDLL from django.contrib.gis.geos.error import GEOSException from django.contrib.gis.geos.libgeos import GEOS_VERSION
# Getting the `free` routine from the C library of the platform.
if os.name == 'nt':
# On NT, use the MS C library.
libc = CDLL('msvcrt')
else:
# On POSIX platforms C library is obtained by passing None into `CDLL`.
libc = CDLL(None)
src/b/a/badger-lib-HEAD/packages/Django/django/contrib/gis/geos/prototypes/errcheck.py badger-lib(Download)
""" Error checking functions for GEOS ctypes prototype functions. """ import os from ctypes import c_void_p, string_at, CDLL from django.contrib.gis.geos.error import GEOSException from django.contrib.gis.geos.libgeos import GEOS_VERSION
# Getting the `free` routine from the C library of the platform.
if os.name == 'nt':
# On NT, use the MS C library.
libc = CDLL('msvcrt')
else:
# On POSIX platforms C library is obtained by passing None into `CDLL`.
libc = CDLL(None)
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 Next