Matthew R. Bisson

Linker Scripting and Linux Shared Library Versioning

The stacks in BPL Version 2.

Shared library versioning is a powerful tool, allowing your library to make new features available without breaking older consumers of them. The problem is — as I’ve noticed through the years — GCC linker scripting seems like witchcraft to many who’d otherwise use it, and only those with tribal knowledge can maintain the library. I agree: this information can be hard to find, and hard to understand. In this article, I’m going to give what I think is a recipe book for using LD version scripting to apply shared library versioning, and keep your library alive and compatible for years.

Continue reading “Linker Scripting and Linux Shared Library Versioning”

An Exploration of the Deleter on the Memory Footprint of std::unique_ptr

(…or “How I Learned to Love the Tuple.”)

Although the C++ standard does not explicitly spell it out, one may hope for a sophisticated implementation of the std::unique_ptr that consumes exactly as much memory as the pointer it tracks when it is configured to use a empty-class deleter (such as the default deleter type). The unique_ptr indeed allows the consumer to supply a custom deleter, which one intuitively expects to consume memory — if you store two pieces of data, you will consume two spots in memory somehow, right? Not quite. I will explore how this is done (specifically in GCC).

Continue reading “An Exploration of the Deleter on the Memory Footprint of std::unique_ptr