On Linux, if compiling code with GCC, the static data's constructor is run at [dlopen(3)][1] time. See also the [visibility attribute][2] and the GCC specific [`__attribute__((constructor))`][3] for functions.

However, you should **define a *plugin* convention**: which names (for `extern "C"` C++ functions inside plugins) are used, with which signatures, in what order, etc.

For example, you could decide that every plugin should have a function `extern "C" void my_plugin_init(void);` which your program would run (after having `dlsym`-ed it) when loading a plugin, etc...

  [1]: http://man7.org/linux/man-pages/man3/dlopen.3.html
  [2]: https://gcc.gnu.org/wiki/Visibility
  [3]: https://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html