| #include <stdlib.h> | |
| #include <stdio.h> | |
| #include <springbok_intrinsics.h> | |
| class ExampleStatic { | |
| public: | |
| ExampleStatic() { | |
| springbok_simprint_error("Hello pre-main C++ world.", 0); | |
| value = 1279; | |
| } | |
| ~ExampleStatic() { | |
| springbok_simprint_error("Goodbye pre-main C++ world.", 0); | |
| } | |
| unsigned int value; | |
| }; | |
| ExampleStatic exampleStatic; | |
| extern "C" __attribute__((constructor)) void boop(void) { | |
| springbok_simprint_error("Hello pre-main C world.", 0); | |
| } | |
| extern "C" __attribute__((destructor)) void beep(void) { | |
| springbok_simprint_error("Goodbye pre-main C world.", 0); | |
| } | |
| extern "C" void blerp(void) { | |
| springbok_simprint_error("Fare thee well, atexit.", 0); | |
| } | |
| extern "C" int main(void) { | |
| static char thingy[10] = {13, 14, 15, 16}; | |
| atexit(blerp); | |
| printf("%s(%d): Hello printf!\n", __PRETTY_FUNCTION__, __LINE__); | |
| return thingy[0] + thingy[1] + thingy[2] + thingy[3] + exampleStatic.value; | |
| } |