How to include .rlib files in cargo?

I have an extern crate foo.rlib, which is not from crates.io and I would like to use it in my rust program. Its local on my computer. How can I tell cargo to use it?

1 Like

I'm not sure whether/how that works with an rlib file, but if you have the source of the crate in a local directory, you can include it in your Cargo.toml like so:

[dependencies]
your_other_crate = { path = "/absolute/or/relative/path/of/the/other/crate's/root/directory" }

Something like that would probably also be required to reasonably package rest libs in Linux distros.

Yes I could use source code like mmmib described. Thanks