SPRU514Z July 2001 – October 2023 SM320F28335-EP
Global C++ variables that have constructors and destructors require their constructors to be called during program initialization and their destructors to be called during program termination. The C++ compiler produces a table of constructors to be called at startup.
Constructors for global objects from a single module are invoked in the order declared in the source code, but the relative order of objects from different object files is unspecified.
Global constructors are called after initialization of other global variables and before the main() function is called. Global destructors are invoked during the exit run-time support function, similar to functions registered through atexit.
Section 7.10.3.4 discusses the format of the global constructor table.