Real-Time Systems Development

The C++ global constructors and destructors are handled conveniently within the ELF format. Constructors all have to be called before entering the main() function, and destructors evoked after exiting from main(). The GNU g++ compiler inserts two auxiliary startup files (crti.o and crtbegin.o) in front of main, and two after it (crtend.o and crtn.o). Crtbegin.o contains a list of pointers to the constructor functions, arranged in the correct order.