I'd like to know what would be the recommended way to deal with gnulib in a project with mutliple shared libraries when compiled with MSVC. The context is compilation of GNU Octave, which consists of multiple shared libraries (one core, and several other all depending on the core one).
I can see 2 ways:
1) compile gnulib statically into each shared library
2) compile gnulib statically into the core library and re-export gnulib symbols from the library to make them available to the other shared libraries
In scenario 1), my concern is about the internal states in some modules. Each DLL will have its own internal states and they won't be shared between the libraries. For instance, the signal handling routines like sigprocmask, sigaction... Are the gnulib's routines designed to support that scenario or will they step on each other's toes when called from various DLL?
I tested scenario 2), libtool being able to export automatically C symbols (auto-export is not supported by MSVC). However, I hit a problem for variables. The getopt module for instance has extern variables (optarg and optind). And MSVC, in its great wisdom, requires that DLL variables be decorated with dllexport/dllimport, which is not the case for the gnulib's getopt module.
So the question is: what would be the recommended way to deal with gnulib and the multiple DLL's in octave?