Trying to interface this C++/C library in Rust. Using bindgen
to generate bindings from the header mcp2210.h
went fine. The tricky part is including the implementation files in the compilation.
This is my build.rs: https://bpaste.net/show/d728826419a9
This is the result: https://bpaste.net/show/68fe1d4d2617
It seems like it's possibly rooted in the fact that hid.c
gets compiled as C++. So I tried to remove .cpp(true)
on line 26. Now I get these errors: https://bpaste.net/show/a9687502c239 It has undefined references to udev functions, although I did add the -ludev
flag. No udev
substring is present in the cc
command shown there. I suppose perhaps it doesn't originate from gcc::Build
at all then.
I get the same errors when I change line 23 of build.rs
to println!("cargo:rustc-link-lib = [mcp2210, udev]");
.
Already found the error (got help on IRC): I had assumed the =
here println!("cargo:rustc-link-lib = [mcp2210, udev]");
worked similar to that in Cargo.toml.. I have to print two lines, one for mcp2210
and one for udev
.