The code snippet declares an API class called gain_phase_calibrate
which inherits from gr::block
. Here, DPD_API
is the class' optional attributes, see class declaration on cppreference.
The DPD_API
macro will expand to platform and compiler specific code which controls the visibility of the class, i.e. whether it can be called from outside of the library.
In plain English, this code says "here's a class called gain_phase_calibrate
and you can call it from your code if you use this library."
These macros are a common sight in C++ libraries. Conventionally, they are called FOO_EXPORT
or FOO_API
(as in this case).
Historically, shared objects on *NIX made all symbols visible while Microsoft's DLLs exposed only those with the __declspec(dllexport)
macro. In the mean time, selectively exposing API symbols also caught on on *NIX.
A good summary for GCC (and comparison with the situation on Windows) can be found here in the GCC wiki on Visibiliy. It also features some sample code not unlike the one in the question.