Using crates like dynamic libraries + native package managers relation with Cargo

This is a great cut. Perhaps the explicit restriction to only support polymorphic-appropriate apis will help shake out which libs would be good candidates. (no serde, yes ripgrep, etc)

There is a storied history of necessary security considerations for using dynamically linked libraries, the long and short of it is if you load a compromised shared library you're screwed, so.... don't do that. :sweat_smile: The how of "just don't do that" comes down to policy and system design which all lie squarely on the OS vendor and shouldn't really affect Rust's implementation.

I wonder if the abi could be designed in such a way that it would allow libraries to be unloaded and new ones loaded live on the fly, without restarting the process. I guess this is typically not done because a process often entangles itself pretty deeply with its libraries and cleanly disentangling them is not worth the headache so restarting the process when a library changes is common. However, with lifetimes perhaps it's possible to have a process pause, cleanly unload a library, reload a new version, and resume knowing that nothing was missed because use of the old library is tied to its expired lifetime. Maybe with tech like Lt<’a> - lifetimes for fn! being discussed elsewhere right now. This is also kinda similar to how Thesus OS is designed to reload and relink crates/cells at runtime.

1 Like