[kwlug-disc] Xubuntu 22.04 to 24.04 Upgrade

Chris Frey cdfrey at foursquare.net
Wed Oct 9 01:04:08 EDT 2024


On Tue, Oct 08, 2024 at 08:33:50PM -0300, Doug Moen wrote:
> Modern system languages like C++, Rust, Zig, and (recently) Go get
> much of their power and performance from compile time code generation
> features that allow library functions to be compiled into different
> machine code specialized for different callers. These features are
> incompatible with compiling a library into a single *.so file that
> is shared by all applications. Static linking must be used.

Are you referring to things like the inline keyword in C++?  That code is
often in the header files and can be duplicated in the program binary,
yes.

But that doesn't mean dynamic libraries are impossible, it simply
gives the choice to the programmer.  And both C++ and Zig give
that choice.

There's a chunk of code in the dynamic libstdc++ .so file
that can be shared, even though there are tons of templates in the
headers that generate static code on the fly as well.

And C++'s stable ABI makes it possible to explicitly instantiate
a template with specific types and have that stored in a .so file too,
if the programmer really wants to go in that direction.

- Chris


[1] Hacked-together proof of concept of templates explicitly placed in
a shared library:
	http://digon.foursquare.net/explicit.tar.bz2




More information about the kwlug-disc mailing list