rust_libloading
rust_libloading copied to clipboard
The specified program cannot be found
The dll file is https://github.com/zhuyu4839/zlgcan-driver/blob/main/zlgcan/library/windows/x86_64/zlgcan.dll
The function named GetIProperty
, ReleaseIProperty
, ZCAN_GetValue
, ZCAN_SetValue
can't found
called
Result::unwrap()on an
Err value: GetProcAddress { source: Os { code: 127, kind: Uncategorized, message: "找不到指定的程序。" } }
This error comes from your OS and is not an issue with libloading specifically. Unfortunately I am not in a position to provide application support here, please use other appropriate channels to discuss use of these system APIs.
All right. but there is no panic when using dlopen2.
Okay, that's quite curious. However as the report is written currently I’m still unable to help or investigate by myself.
In order for me to look into this, I would need a reproducer that does not involve binary executable code downloaded off internet. I’m not currently in a position to set up a VM to test your library.
If you are up to testing some things, it would be great if you compared not with dlopen2
and other competing crates, but windows API. Can you try something like:
// use the `windows-sys` crate with the "Win32_Foundation" feature enabled
use windows_sys::Win32::System::LibraryLoader;
let handle = LibraryLoader::LoadLibraryA(b"C:\\path\\to\\zlgcan.dll\0");
assert!(handle != 0);
let symbol = LibraryLoader::GetProcAddress(handle, b"ZCAN_GetValue\0");
assert!(symbol.is_some());
this is effectively what libloading should be doing under the covers. If this fails as well, then it will be curious to see what dlopen2
is doing differently and why it works. If this does work, then it might have something to do with e.g. https://github.com/nagisa/rust_libloading/pull/125.
Which brings me to another thing to try -- is this something that started happening in a recent release? Can you check if, perhaps, libloading 0.7.4 works? It should need no changes to your reproducer.
Ok. I'll try it later because i'm refactoring the code.