I have a set of plugins for an application which all link to a common base library. The base library defines a singleton which maintains a list of all object constructors in each plugin.
On windows, I can create this base library as a static library and thus a copy of the singleton is placed in each plugin. However on Linux I have a bit of the opposite problem as this fellow.
I've tried the following so far:
- Build base as shared library (as per the original author)
- Build base as static with -fPIC
- Build base as static with -fPIC, explicitly remove -rdynamic in CMake
I would really like to keep the program structure the same as it is now by having the singleton definition reside inside of the base library for each plugin to have it's own instance. I have experimented with moving the definition into each plugin but I'd really like to avoid that. Essentially I want to reproduce what he considers a bug. However he defines his singleton completely in one header file which makes sense to me that each plugin would then have its own instantiation of the class, I on the other hand have the definition of the singleton compiled into the base library.