Shared libraries
Shared libraries
Posted Nov 26, 2025 13:42 UTC (Wed) by khim (subscriber, #9252)In reply to: Shared libraries by farnz
Parent article: APT Rust requirement raises questions
> I'm saying that we need the tools to allow developers to decide what falls on the "shared binary" side of the library
Nope. We need tools that simply work. Developer shouldn't consult some large document to find out what would be embedded where. Except in rare cases marked unsafe. C/C++ tried that “you are holding it wrong” approach — and it doesn't scale.
Developers have some ideas about what it takes to have stable API (and there are checkers for that), that should be enough. How exactly compiler would ensure that stable API would become stable ABI, also — is on the shoulders of the compiler.
> in C++, this got forced on compilers by the header file/object file split, where things in the header files are "inlined into the user", and things in the object files are not.Yes. In C++ they had this split from the day one — that's why it worked. Rust had no such split, thus it wouldn't work.
> And that's why I want to offer that - I want library authors (who presumably understand the library code) to be able to decide what is inlined into the calling binary, and what is put in the library's binary, with tooling support for stopping them from accidentally changing something from inlined into the caller's binary to part of the library's binary.This could be an external addon, sure. But by default things should just work. Otherwise no one would adopt that solution.
Developers are not malicious, but lazy. Take that into account — and that would be enough to develop sane approach.
Provide tools that allow some kind of perfection after you'll provide something that “just works”.
