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