There were a few bugs in the code examples that have been fixed.
The loop in
_startup() that calling each entry
__init_array_end was incorrect in
Startup Code in C and Startup Code in
C++. It has been fixed and tested.
To test it the
main.c routine was updated to demonstrate the operation of the
contructors called in
main() is called.
The corrected C code is below:
Some test code was added to
A trace shows both variables written before main is reached.
global_value1_with_constructoris initalized to
- Startup iterates over
setup_global1()is called it is set to
setup_global2()is called it is set to