Static Class Variables in Dynamic Library and Main Program [duplicate]
问题 This question already has an answer here : Main Program and Shared Library initializes same static variable in __static_initialization_and_destruction_0 (1 answer) Closed last year . I am working on a project that has a class 'A' that contains a static stl container class. This class is included in both my main program and a .so file. The class uses the default(implicit, not declared) constructor/destructor. The main program loads the .so file using dlopen() and in its destructor, calls