File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -44,15 +44,17 @@ def _load_shared_library(lib_base_name: str):
44
44
_base_path = _lib .parent .resolve ()
45
45
_lib_paths = [_lib .resolve ()]
46
46
47
+ cdll_args = dict () # type: ignore
47
48
# Add the library directory to the DLL search path on Windows (if needed)
48
49
if sys .platform == "win32" and sys .version_info >= (3 , 8 ):
49
50
os .add_dll_directory (str (_base_path ))
51
+ cdll_args ["winmode" ] = 0
50
52
51
53
# Try to load the shared library, handling potential errors
52
54
for _lib_path in _lib_paths :
53
55
if _lib_path .exists ():
54
56
try :
55
- return ctypes .CDLL (str (_lib_path ), winmode = 0 )
57
+ return ctypes .CDLL (str (_lib_path ), ** cdll_args )
56
58
except Exception as e :
57
59
raise RuntimeError (f"Failed to load shared library '{ _lib_path } ': { e } " )
58
60
You can’t perform that action at this time.
0 commit comments