Linking a 64bit dll to the Rust project

80 Views Asked by At

I'm new to programming, and especially to the Rust language, and I'm trying to figure out how to connect a 64-bit library. to the project. The library is compiled in Rad Studio, but there is also a similar one compiled in C++ I use Windows 11 64bit, I write it in build

println!(r"cargo:rustc-link-search=C:\\dev\\ITNI\\Doc\\Lib64");
     println!(r"cargo:rustc-link-lib=dylib=myLib64");

I choose the toolchain rustup default stable-x86_64-pc-windows-msvc But when compiling I get an error:

error: linking with `link.exe` failed: exit code: 1181
  |
  = note: "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.36.32532\\bin\\HostX64\\x64\\link.exe" "/NOLOGO" "C:\\Users\\kovin\\AppData\\Local\\Temp\\rustc5HA3nf\\symbols.o"

///////////

  = note: LINK : fatal error LNK1181: cannot open input file 'myLib64.lib'

Everything works with the 32-bit version of the dll by changing:

println!(r"cargo:rustc-link-search=C:\\dev\\ITNI\\Doc\\Lib32");
    println!(r"cargo:rustc-link-lib=dylib=myLib32");

and selecting the toolchain rustup default stable-i686-pc-windows-gnu But I would like to use a 64bit dll. This library connects to projects written in other languages (C++), but for some reason it does not work in Rust. I would be grateful for any help in solving this.

0

There are 0 best solutions below