diff --git a/ChangeLog.md b/ChangeLog.md index 4c87abf45..0d1f22302 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -7,6 +7,11 @@ More detailed information about incremental changes can be found in the ## 3.14 +### 3.14.16 (2024-04-22) + +- Fixed load of linear solver libraries at runtime on Windows, which got + broken for relative paths (the default) in 3.14.15 [#759]. + ### 3.14.15 (2024-04-10) - Fixed include guard of IpGenAugSystemSolver.hpp [#756, by Christopher Wellons]. diff --git a/src/Common/IpLibraryLoader.cpp b/src/Common/IpLibraryLoader.cpp index 2ad3bc97e..0ae8a142c 100644 --- a/src/Common/IpLibraryLoader.cpp +++ b/src/Common/IpLibraryLoader.cpp @@ -50,7 +50,14 @@ void LibraryLoader::loadLibrary() } #ifdef HAVE_WINDOWS_H - libhandle = (void*)LoadLibraryExA(libname.c_str(), NULL, LOAD_LIBRARY_SEARCH_DEFAULT_DIRS | LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR); + /* if absolute path, then use LoadLibraryExA with LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR to find + * dependencies of library in same directory + * otherwise, use standard search paths (which includes PATH) + */ + if( libname.length() > 2 && libname[1] == ':' ) + libhandle = (void*)LoadLibraryExA(libname.c_str(), NULL, LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR); + else + libhandle = (void*)LoadLibraryA(libname.c_str()); if( libhandle == NULL ) {