Comment by jjmarr
1 year ago
Isn't this how dynamic linking works? If you really want to reduce build times, you should be making your hot path in the build a shared library, so you don't have to relink so long as you're not changing the interface.
1 year ago
Isn't this how dynamic linking works? If you really want to reduce build times, you should be making your hot path in the build a shared library, so you don't have to relink so long as you're not changing the interface.
But do rust’s invariants work across dynamic links?
I thought a lot of its proofs were done at compile time not link time.
Yesn't.
Rust is perfectly happy to emit/use dynamic links.[0] It's just that the primary C use case (distributing and updating the main app and its libraries separately) ends up being unsafe since Rust's ABI is unstable (so compiler versions, libraries, etc must match exactly).
Avoiding static relinking during development is pretty much the use where it does work. In fact, Bevy recommends this as part of its setup guide![1]
Practice paints a slightly less rosy picture, though; since the feature is exercised quite rarely, not all libraries work well with it in practice.[2]
[0]: https://doc.rust-lang.org/reference/linkage.html#r-link.dyli...
[1]: https://bevyengine.org/learn/quick-start/getting-started/set...
[2]: For example, https://github.com/linebender/bevy_vello/issues/84
The proof can be done on the whole code (in memory, incremental, etc), and then the modules emitted as dynamically loadable objects.