blob: 3285c76b86ed2316676628153fa8e84e6a342d55 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
--- rpython/rlib/libffi.py.orig 2017-10-03 10:53:54 UTC
+++ rpython/rlib/libffi.py
@@ -434,11 +434,12 @@ class Func(AbstractFuncPtr):
# XXX: it partially duplicate the code in clibffi.py
class CDLL(object):
- def __init__(self, libname, mode=-1):
+ def __init__(self, libname, mode=-1, lib=0):
"""Load the library, or raises DLOpenError."""
- self.lib = rffi.cast(DLLHANDLE, 0)
- with rffi.scoped_str2charp(libname) as ll_libname:
- self.lib = dlopen(ll_libname, mode)
+ self.lib = rffi.cast(DLLHANDLE, lib)
+ if lib == 0:
+ with rffi.scoped_str2charp(libname) as ll_libname:
+ self.lib = dlopen(ll_libname, mode)
def __del__(self):
if self.lib:
|