nagisa / rust_libloading

Bindings around the platform's dynamic library loading primitives with greatly improved memory safety.
https://docs.rs/libloading
ISC License
1.22k stars 100 forks source link

Nested Dlls will load not found module #110

Closed Richyeoh closed 2 years ago

Richyeoh commented 2 years ago

code: 126, kind: Uncategorized, message: "找不到指定的模块。"

image

More error info: image

Richyeoh commented 2 years ago

Maybe you shoud change here: image LoadLibraryExW that dwFlags is zero will like LoadLibraryA that load dll filee.

Richyeoh commented 2 years ago

https://docs.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-loadlibraryexw#parameters According to the document, I think we shoud be use LOAD_LIBRARY_SEARCH_DEFAULT_DIRS(0x00001000, This value represents the recommended maximum number of directories an application should include in its DLL search path.

Richyeoh commented 2 years ago

Sry, It my wrong, Maybe can use SetDllDirectoryA or AddDllDirectory to resolution .

nagisa commented 2 years ago

The choice to specify flags to 0 by default was a conscious decision as the behaviour better matches that of other platforms. If you’d like to customize the behaviour on Windows specifically, I believe libloading::os::windows::Library::load_with_flags and then converting with libloading::Library::from should work well.