Skip to content

Commit 62a0ee6

Browse files
h-g-sCopilot
andcommitted
cbc: add FileNotFoundError for missing libCbc.dll on Windows
The cbcbox Windows wheel currently only ships libCbc.a (static archive) with no shared libCbc.dll. Add an explicit check so the error message clearly identifies the missing file instead of a cryptic dlopen failure. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 3f35f99 commit 62a0ee6

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

mip/cbc.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@
8383
# autotools/MinGW places DLLs under bin/, not lib/
8484
_bin_dir = os.path.join(_cbcbox.cbc_dist_dir(), "bin")
8585
libfile = os.path.join(_bin_dir, "libCbc.dll")
86+
if not os.path.exists(libfile):
87+
raise FileNotFoundError(
88+
"libCbc.dll not found in cbcbox Windows distribution at"
89+
" {}. The cbcbox Windows wheel may only contain a static"
90+
" libCbc.a. A shared libCbc.dll is required.".format(_bin_dir)
91+
)
8692
# Python 3.8+ ignores PATH for DLL resolution; use add_dll_directory
8793
if hasattr(os, "add_dll_directory"):
8894
os.add_dll_directory(_bin_dir)

0 commit comments

Comments
 (0)