Skip to content

Commit f6ce6ca

Browse files
committed
revert changes in cppyy __init__
1 parent dc5545b commit f6ce6ca

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

bindings/pyroot/cppyy/cppyy/python/cppyy/__init__.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ def __getitem__(self, cls):
177177
return py_make_smartptr(getattr(gbl, cls), self.ptrcls)
178178
return self.maker[cls]
179179

180-
# gbl.std.make_shared = make_smartptr(gbl.std.shared_ptr, gbl.std.make_shared)
181-
# gbl.std.make_unique = make_smartptr(gbl.std.unique_ptr, gbl.std.make_unique)
180+
gbl.std.make_shared = make_smartptr(gbl.std.shared_ptr, gbl.std.make_shared)
181+
gbl.std.make_unique = make_smartptr(gbl.std.unique_ptr, gbl.std.make_unique)
182182
del make_smartptr
183183

184184

@@ -265,9 +265,18 @@ def macro(cppm):
265265
def load_library(name):
266266
"""Explicitly load a shared library."""
267267
with _stderr_capture() as err:
268-
result = gbl.Cpp.LoadLibrary(name, True)
269-
if result == False:
270-
raise RuntimeError('Could not load library "%s": %s' % (name, err.err))
268+
gSystem = gbl.gSystem
269+
if name[:3] != 'lib':
270+
if not gSystem.FindDynamicLibrary(gbl.TString(name), True) and\
271+
gSystem.FindDynamicLibrary(gbl.TString('lib'+name), True):
272+
name = 'lib'+name
273+
sc = gSystem.Load(name)
274+
if sc == -1:
275+
# special case for Windows as of python3.8: use winmode=0, otherwise the default
276+
# will not consider regular search paths (such as $PATH)
277+
if 0x3080000 <= sys.hexversion and 'win32' in sys.platform and os.path.isabs(name):
278+
return ctypes.CDLL(name, ctypes.RTLD_GLOBAL, winmode=0) # raises on error
279+
raise RuntimeError('Unable to load library "%s"%s' % (name, err.err))
271280

272281
return True
273282

0 commit comments

Comments
 (0)