Link against external DLL
from to on 13 Mar 2024 21:01


I am trying to use the SDK provided by the manufacturer of a camera from Rust. I use this in the :

println!(r"cargo:rustc-link-search=C:\Program Files\Digital Camera Toolbox\Camware4");

However, it tries to find a .lib file, while the actual file is SC2_Cam.dll. I’ve tried specifying the kind as dylib=SC2_Cam but it makes no difference.

Am I missing something obvious, or is it just not possible? Do I have to manually load the DLL at runtime with things like the libloading crate?


threaded - newest on 14 Mar 2024 06:53 collapse

The Windows linker needs a lib file to link a DLL. See here how it’s done on 14 Mar 2024 10:26 collapse

Thank you very much for your reply. I have tried the approach you explain in your blog post, and it works. Your blog post is useful and clearly written ! on 14 Mar 2024 17:56 collapse

Happy to hear that it worked!