nagisa / rust_libloading

Bindings around the platform's dynamic library loading primitives with greatly improved memory safety.

Home Page:https://docs.rs/libloading

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow altering search path - add LoadLibraryExW on Windows

NightRa opened this issue · comments

We've got a scenario where we want to alter the search path of LoadLibrary, which is done via the flags passed to LoadLibraryExW.

For example, we would like to avoid searching the user's PATH for the library, and only search the application directory - which is the flag LOAD_LIBRARY_SEARCH_APPLICATION_DIR.

So this means adding another new function to the windows-specific module, which calls LoadLibraryExW, and allows passing flags. (Note they may be combined, so we can use the bitflags crate for that)

Relevant issues:
rust-windowing/glutin#1292
feenkcom/gtoolkit#973

Do you want to submit a pull request with the proposed constructor? Unix already has a similar function that accepts platform-specific flags, so I don’t see much reason to not add a similar one for Windows.