Gnuradio library symbol visibility

Currently there is nothing in gnuradio to control the visibility of
symbols. That is, everything in every header file is probably an
exported symbol right now, though in many cases, that may not be

GCC documents what they call “symbol visibility” here (see the macro
towards the bottom): Visibility - GCC Wiki

Basically, whenever a symbol is meant to be part of the API (called
through the library), you define it with a special macro:


class foo{…} becomes class GR_API foo{…}
void bar(…) becomes GR_API void bar(…)

The catch here is that libraries would be (in the case of GCC only)
built with -fvisibility=hidden. So if a class does not have the special
macro, it will not be available to the linked application.

This nice part is that this is easy to debug because a missing symbol
export will cause an obvious linker error when linking against a
dependent library.

I would like to add to header files in gnuradio, the explicit
exportation of symbols that are supposed to be in the public API.

I will start off by adding the export macro to the headers of major
components and checking that it compiles as I go. These changes could be
safely merged into the next branch and not affect anybody’s build so
long as the compiler option “-fvisibility=hidden” is unspecified by
default. When the work is completed, and we are comfortable with the
changes “-fvisibility=hidden” would be set by default.

This gives gnuradio a path to building in environments that require
explicit symbol exportation and importation. Example" building native on
windows with MSVC. Also, being explicit about the API and the available
symbols in a library seems to be a good thing to do.