8000 Use LoadLibraryExA for more robust library loading by metab0t · Pull Request #755 · coin-or/Ipopt · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Use LoadLibraryExA for more robust library loading #755

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 25, 2024

Conversation

metab0t
Copy link
Contributor
@metab0t metab0t commented Mar 25, 2024

The Windows DLL search path is cumbersome : https://learn.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibraryexa
For example, if the libhsl.dll in located in D:\hsl directory:

D:\hsl
| - libhsl.dll
| - libmetis.dll
| - ...

The libhsl.dll depends on libmetis.dll, but LoadLibrary("D:\\hsl\\libhsl.dll") cannot load libmetis.dll in the same directory.
By using LoadLibraryExA function, setting LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR flag can add the directory that contains the DLL temporarily to the beginning of the list of directories that are searched for the DLL's dependencies. In this way, libmetis.dll can be loaded successfully.

@CLAassistant
Copy link
CLAassistant commented Mar 25, 2024

CLA assistant check
All committers have signed the CLA.

@svigerske
Copy link
Member

Thank you. That looks interesting. We could then just skip the first LoadLibrary() call?

@metab0t
Copy link
Contributor Author
metab0t commented Mar 25, 2024

yes, the first call to LoadLibrary can be omitted. I will change it.

@svigerske svigerske self-assigned this Mar 25, 2024
@metab0t metab0t force-pushed the metab0t-loadlibrary branch from efb16be to f5ac618 Compare March 25, 2024 13:48
@svigerske svigerske merged commit 97d4f54 into coin-or:stable/3.14 Mar 25, 2024
@metab0t
Copy link
Contributor Author
metab0t commented Mar 26, 2024

I confirm that it can make libipopt-3.dll load libhsl.dll with its full path correctly.

@metab0t
Copy link
Contributor Author
metab0t commented Apr 10, 2024

@svigerske Can we have a new release 3.14.15 with Windows binaries to contain this patch?

@svigerske
Copy link
Member

Yes. https://github.com/coin-or/Ipopt/releases/tag/releases%2F3.14.15

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0