How can i use the rlib without the source code in rust

I have a common_lib.rlib and a program. I'm trying to use the .rlib in my program without the library's source code. I’m using the following build script:

fn main() {
    println!("cargo:rustc-link-search=native=./lib"); // My lib folder
    println!("cargo:rustc-link-lib=static=common_lib"); // My lib name
}

However, I encounter link errors when I run cargo build:

LINK : fatal error LNK1181: cannot open input file 'common_lib.lib'

Why is the linker looking for a file with a .lib extension instead of a .rlib? How can I fix this?

Well, I checked the forums, and .rlib is not a recommended way. If my colleagues and I need a library but the source code is restricted, what features should I use to ensure that the source code is not exposed while we collaborate?

You can check out this thread: