summaryrefslogtreecommitdiff
path: root/cffi/backend_ctypes.py
diff options
context:
space:
mode:
authorArmin Rigo <arigo@tunes.org>2012-09-24 11:00:04 +0200
committerArmin Rigo <arigo@tunes.org>2012-09-24 11:00:04 +0200
commitf93997ba8e75434dc9b6e7479cae324fa7e7c081 (patch)
tree5b5efd276f4a6779b860eb4419416d9493400b38 /cffi/backend_ctypes.py
parent42b970f5cf60781d3b41916bb99b958c6bac53d8 (diff)
downloadcffi-f93997ba8e75434dc9b6e7479cae324fa7e7c081.tar.gz
Change the default dlopen() flags from RTLD_LAZY to RTLD_NOW.
Give access to all flags, for more precise control.
Diffstat (limited to 'cffi/backend_ctypes.py')
-rw-r--r--cffi/backend_ctypes.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/cffi/backend_ctypes.py b/cffi/backend_ctypes.py
index 506226c..e991968 100644
--- a/cffi/backend_ctypes.py
+++ b/cffi/backend_ctypes.py
@@ -287,6 +287,12 @@ class CTypesBackend(object):
'_Bool': ctypes.c_bool,
}
+ def __init__(self):
+ self.RTLD_LAZY = 0 # not supported anyway by ctypes
+ self.RTLD_NOW = 0
+ self.RTLD_GLOBAL = ctypes.RTLD_GLOBAL
+ self.RTLD_LOCAL = ctypes.RTLD_LOCAL
+
def set_ffi(self, ffi):
self.ffi = ffi
@@ -309,8 +315,8 @@ class CTypesBackend(object):
result['ssize_t'] = size
return result
- def load_library(self, path):
- cdll = ctypes.CDLL(path)
+ def load_library(self, path, flags=0):
+ cdll = ctypes.CDLL(path, flags)
return CTypesLibrary(self, cdll)
def new_void_type(self):