Hello! I am faced with programming style based on many global variables declared in header files. A header looks like this ... ONLY_ONCE const MyClass MyObject; .... could be included in several source files. ONLY_ONCE defined as _declspec(selectany) for MS VS, and __attribute__((weak)) for gcc. It works perfectly, although amount of code gcc generates is huge. As far as I understand, gcc puts initialization of all such objects in per compilation unit _static_initialization_and_destruction function and uses guard variables to be sure objects initialized once, while MS VS is much smarter and eliminates all but one initialization per module (actually dll). So, in case of gcc I have code initializes an object as many times as many compilation units I have in my shared object (of course, actually it works once and behavior is correct - I am worried about size of binaries). Questions. 1. Does my vision make sense? 2. Is it possible to change the situation by some tuning of compiler and/or linker (I cannot get rid of this ONLY ONCE objects)? 3. I use gcc 3.2.2 and ld 2.13.90.0.18. Any hope things whould be changed if I step forward? Many thanks. -- Best regards Ilja Golshtein