Static initialization and destruction of a static library's globals not happening with g++
问题 Until some time ago, I thought a .a static library was just a collection of .o object files, just archiving them and not making them handled differently. But linking with a .o object and linking with a .a static library containing this .o object are apparently not the same . And I don't understand why... Let's consider the following source code files: // main.cpp #include <iostream> int main(int argc, char* argv[]) { std::cout << "main" << std::endl; } // object.hpp #include <iostream> struct