Shared libraries
Shared libraries
Posted Nov 26, 2025 17:23 UTC (Wed) by khim (subscriber, #9252)In reply to: Shared libraries by farnz
Parent article: APT Rust requirement raises questions
> Runtime descriptors get filled in by the dynamic linker
Nope. Not even remotely close. Rather it's extension of current dyn Trait scheme: in the vtable there are size of the object (so it can be allocated on stack, alloca-style), reference to the constructor (so you can create a vector) and so on. Then generic may have one, common code for that thing and work — even without any dynamic linkage involved.
Very natural extension of the Rust language, not special code for the dynamic libraries. It would be well-received even without dynamic libraries, the ability to have true polymorphic callback is something people desire often.
> After all, the lesson of C++ UB is that "programmers don't make that mistake" is virtually always false.Yes, but that doesn't mean we have to invent something grandiose, that would require next 10 or 20 years to develop. Simple solution may be better, because it's actually implementable… and we know, from Swift example, what can be implemented in the limited time.
Hint: anything that requires changes to the dynamic linker automatically makes the whole thing DOA. Simply because on Windows dynamic linker is part of the OS and if this scheme wouldn't support Windows then nobody serious would use it.
