0

There is a code that loads the dynamic library

extern crate libloading;

fn main() {
    let lib = unsafe { libloading::Library::new("C:\\Users\\Administrator\\Desktop\\dlls\\nss3.dll") }.unwrap();
}

But when I run the code I get an error

source: Os { code: 126, kind: Uncategorized, message: "The specified module could not be found." }

I tried building the project as i686-pc-windows-msvc. But it did not help Library 32 bit

$ file nss3.dll 
nss3.dll: PE32 executable (DLL) (GUI) Intel 80386, for MS Windows
  • 1
    See answers [here](https://stackoverflow.com/a/13475984/2189130) and [here](https://stackoverflow.com/a/25685000/2189130). Either it can't find your `dll` or it can't find a dependency that your `dll` requires. – kmdreko Jan 22 '22 at 20:33
  • I did all the dependencies but now I am getting this error { source: Os { code: 193, kind: Uncategorized, message: "%1 is not a valid Win32 application." } } – Dima Tverdoy Jan 22 '22 at 21:01
  • The nss3.dll is compiled as a 32-bit DLL. You won't be able to load it in a 64-bit application, like what I presume your Rust program is. – Colonel Thirty Two Jan 28 '22 at 15:54

0 Answers0