The Rust FAQ officially endorses libloading. Beyond that, there are three different options I know of:
- Use the shared_library crate
- Use the dylib crate.
- Use
std::dynamic_lib
, which is deprecated since Rust 1.5. (These docs are no longer available in version 1.32; it's likely the feature has been dropped altogether by now.)
I haven't tried any of these, so I cannot really say which is best or what the pros/cons are for the different variants. I'd strongly advise against using std::dynamic_lib
at least, given that it's deprecated and will likely be made private at some point in the future.