Let’s make easy to use libraries -- Martin Knoblauch

Some sessions from the recent using std::cpp are now online.

Let’s make easy to use libraries

by Martin Knoblauch

About the session

We often use libraries with annoying, error prone interfaces. The main cause is the potential incompatibility between the library and the program using it, due to being compiled with different compiler versions or settings. Another well known issue is the usage of separated heaps by the program and the library in Windows. These problems can be solved (at a very high cost!) by using pure C interfaces and/or the Hourglass Pattern. In this talk I propose designing interfaces using a selected set of C++ features that should be very unlikely to cause ABI incompatibilities. I will focus on the usage of std::unique_ptr with custom deleters to manage the lifetime of objects passed through the library interface, thus making life easier for both the library implementor and the library user. Needless to say, a full Hourglass Pattern interface can also benefit from using std::unique_ptr.

Martin Knoblauch (Indizen). Fiddling with computers since the mid 80's, passionate about C++ since the 90's, C and C++ lecturer in the 00's. At Indizen since 2014. Member of the Spanish C++ Standards Committee.



Add a Comment

Comments are closed.

Comments (0)

There are currently no comments on this entry.