Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cbac19b

Browse filesBrowse files
committed
Add winmode arg only on windows if python version supports it
1 parent c804efe commit cbac19b
Copy full SHA for cbac19b

File tree

Expand file treeCollapse file tree

1 file changed

+3
-1
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-1
lines changed

‎llama_cpp/llama_cpp.py

Copy file name to clipboardExpand all lines: llama_cpp/llama_cpp.py
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,17 @@ def _load_shared_library(lib_base_name: str):
4444
_base_path = _lib.parent.resolve()
4545
_lib_paths = [_lib.resolve()]
4646

47+
cdll_args = dict() # type: ignore
4748
# Add the library directory to the DLL search path on Windows (if needed)
4849
if sys.platform == "win32" and sys.version_info >= (3, 8):
4950
os.add_dll_directory(str(_base_path))
51+
cdll_args["winmode"] = 0
5052

5153
# Try to load the shared library, handling potential errors
5254
for _lib_path in _lib_paths:
5355
if _lib_path.exists():
5456
try:
55-
return ctypes.CDLL(str(_lib_path), winmode=0)
57+
return ctypes.CDLL(str(_lib_path), **cdll_args)
5658
except Exception as e:
5759
raise RuntimeError(f"Failed to load shared library '{_lib_path}': {e}")
5860

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.