1 #include <stdio.h>
2 #include <wizer.h>
3 
4 class Test {
5   public:
6     Test() : value(1) {
7         printf(
8             "global constructor (should be the first printed line)\n");
9     }
10     ~Test() {
11         printf("global destructor (should be the last printed line)\n");
12     }
13     int value;
14 };
15 
16 bool initialized = false;
17 int orig_value = 0;
18 Test t;
19 
20 static void init_func() {
21     // This should run after the ctor for `t`, and before `main`.
22     orig_value = t.value;
23     t.value = 2;
24     initialized = true;
25 }
26 
27 WIZER_INIT(init_func);
28 
29 int main(int argc, char** argv) {
30     if (!initialized) init_func();
31     printf("argc (should not be baked into snapshot): %d\n", argc);
32     printf("orig_value (should be 1): %d\n", orig_value);
33     printf("t.value (should be 2): %d\n", t.value);
34 }
35