Skip to content

Commit 94c6561

Browse files
committed
Fix DLL search
1 parent 50e4607 commit 94c6561

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

include/pyoptinterface/dylib.hpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,14 @@ class DynamicLibrary
3030
bool try_load(const char *library)
3131
{
3232
#if defined(_MSC_VER)
33-
handle = static_cast<void *>(LoadLibraryExA(
34-
library, NULL, LOAD_LIBRARY_SEARCH_DEFAULT_DIRS | LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR));
33+
handle = static_cast<void *>(LoadLibraryA(library));
34+
35+
if (handle == nullptr)
36+
{
37+
handle = static_cast<void *>(LoadLibraryExA(library, NULL,
38+
LOAD_LIBRARY_SEARCH_DEFAULT_DIRS |
39+
LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR));
40+
}
3541

3642
#else
3743
handle = dlopen(library, RTLD_NOW);

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "scikit_build_core.build"
44

55
[project]
66
name = "pyoptinterface"
7-
version = "0.2.0"
7+
version = "0.2.1.dev1"
88
description = "Python interface to multiple optimization solvers"
99
readme = "README.md"
1010
requires-python = ">=3.8"

0 commit comments

Comments
 (0)