Stream: general

Topic: using rlib libraries


Francesco Dainese (Jul 13 2019 at 20:53, on Zulip):

Hello everyone.
Today I'm here to ask you how does one link and use an rlibfile from within another crate.
I know how to produce an rlib file but after that I don't know how to link it in another crate and how can I actually use the exposed functions.
I tried the links attribute along with an empty build script, since I wanted to use the override anyway, but I couldn't find the key to tell cargo that it should link an rlib and not a normal static lib... So that didn't work.
Suppose I was able to tell cargo to link my rlib file, how am I supposed to use it in my application/library? Should I extern crate my_lib; or extern "C" { fn my_func() }?
Thank you for your help and for your time. If this doesn't belong here let me know.

nagisa (Jul 13 2019 at 21:53, on Zulip):

you use rlibs by giving rustc --extern <crate>=<pathtorlib>

Last update: Nov 22 2019 at 00:10UTC