I am maintaining a small application that has some plugin-like functionality, which is implemented through runtime-loaded dynamic modules.
Specifically, since it's a Gtk+ app, I'm using gmodule, but the question applies to dlfcn.h / dlopen() based dynamic library loading just as well.
My main program has a single, global struct variable holding some global information. I want this information to be available to functions defined in the dynamically loaded plugins.
On Linux, I could just refer to this global variable directly - this works well, and I'm guessing that gcc or the linker take care of exporting the global variables from the main program to dynamic libraries.
Problem is, this doesn't work on Mac OS X.
Is there a way to do this on OS X?
If not, is there a more "best practice" way to expose global information to dynamically loaded libraries?
Thanks!