C++ API & ABI versioning

Speaker: Mathieu Ropert

Audience level: Intermediate

category

Software keeps changing, but not always as fast as its clients. A key to maintaining a library in the long run is to ensure a proper versioning of the API and ABI. Not only does this gives a clear picture of both source and binary compatibility between the versions, but it also helps design by making breaking changes explicit to the developer.

In this talk I will define API and ABI in terms of impacts on compatibility, explain the difference between breaking and non-breaking changes and present a few techniques to handle them.

We will quickly explain what APIs are, with an emphasis on the notion of contracts. Then the usually lesser known notion of ABI will be explained, going over the concepts of call syntax, mangling and most importantly sizes, alignment and offsets in data structures. We will see how to use semantic versioning (semver) in C++ by considering not only changes to the API but also to the ABI and offer some advice on how to change API and ABI over time and how to minimize the impacts.