this post was submitted on 13 Mar 2024
21 points (92.0% liked)

Rust

5989 readers
63 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

!performance@programming.dev

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 1 year ago
MODERATORS
 

Hello,

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

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

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?

top 3 comments
sorted by: hot top controversial new old
[–] secana@programming.dev 11 points 8 months ago (1 children)

The Windows linker needs a lib file to link a DLL. See here how it's done https://kellnr.io/blog/cross-plat-native-lib

[–] japps13@lemmy.physfluids.fr 8 points 8 months ago (1 children)

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 !

[–] secana@programming.dev 2 points 8 months ago

Happy to hear that it worked!