Shared libraries
Shared libraries
Posted Nov 26, 2025 16:11 UTC (Wed) by khim (subscriber, #9252)In reply to: Shared libraries by Wol
Parent article: APT Rust requirement raises questions
> So you allow Rust to use the "extern" keyword. Which freezes the layout according to certain rules.
It's not enough to just freeze a layout. Option<&str> contains either None or reference to a valid UTF-8 string. Nothing else is allowed. If handling of it is inlined into both binary and library then they should agree about upholding such invariants.
This would never work. The big advantage of Rust is the fact that compiler (and, most notably, not a developer) upholds many such invariants.
We need this guarantee kept across shared libraries boundary or it'll never work.
