#Cannot make Rust bindings for a C library
5 messages · Page 1 of 1 (latest)
the process of using C functions in rust is called c binding , what you have to do :
declare the external function that you will be using in your rust code : manually or using bindgen tool (https://rust-lang.github.io/rust-bindgen/introduction.html) which requires you to have the libnumpulate.h.
bindgen automatically generates Rust FFI bindings to C and C++ libraries.
when compiling you need to provide the path to your libnumpulate.a file to rust compiler
one way to do it is by adding a file called build.rs at the root of your project and put inside it fn main() { println!("cargo:rustc-link-search=PATH_to_lib/libnumpulate.a); println!("cargo:rustc-link-lib=static=test"); }