I am trying to link a Rust program to libsoundio . I use Windows, and there is GCC binary download available. I can link it like this if I put it in the same folder as my project:
#[link(name = ":libsoundio-1.1.0/i686/libsoundio.a")]
#[link(name = "ole32")]
extern {
fn soundio_version_string() -> *const c_char;
}
But I really want to point out #[link(name = "libsoundio")]or even #[link(name = "soundio")], and then provide the linker path somewhere else.
Where can I point this way?
I tried the sentence rustc-link-searchas follows:
#[link(name = "libsoundio")]
#[link(name = "ole32")]
extern {
fn soundio_version_string() -> *const c_char;
}
And in .cargo/config:
[target.i686-pc-windows-gnu.libsoundio]
rustc-link-search = ["libsoundio-1.1.0/i686"]
rustc-link-lib = ["libsoundio.a"]
[target.x86_64-pc-windows-gnu.libsoundio]
rustc-link-search = ["libsoundio-1.1.0/x86_64"]
rustc-link-lib = ["libsoundio.a"]
But it still skips "-l" "libsoundio"in gcc and fails with the same ld: cannot find -llibsoundio. Am I missing something really obvious? The docs seem to suggest that this should work.