Well, you can't expect linker to guess itself which globals are
unreferenced
but needed, can't you?
If you have read my reply to Uli you can see what I found in C++
Standard Documentation. It is stated that if global variables have
initialisation or destructor they should not be eliminated by the
linker even if they are not referenced by any other piece of code.
That is what the standard tells and to me Microsoft implementation is
not correct.
Just create one "superclass" that will contain your globals as members,
then
create static instance of that class and pass it to the linker...
Globals are defined in several different object files depending on
other content of the file and inside their constuctor register
themselves in a global map object. I am not sure your suggestion could
be applied in this case.
Thanks anyway for your proposals!
Best regards,
B.