Almost all modern languages have the ability to make libraries, a collection of classes, and methods that have a well-defined interface. C++ is no exception to this rule. We have two types of libraries: runtime (also called shared or dynamic) and static. But, writing libraries is not a simple task in C++. Different platforms have different methods for describing which symbols must be exported from the shared library.
Let's take a look at how to manage symbol visibility in a portable way using Boost.
The code for this recipe consists of two parts. The first part is the library itself. The second part is the code that uses that library. Both parts use the same header, in which the library methods are declared. Managing symbol visibility in a portable way using Boost is simple and can be done using the following steps:
- In the header...