• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include <stdlib.h>
2 #include <stdio.h>
3 #include "lib_static_init.h"
4 
5 Foo  theFoo2;
6 
main(int argc,char ** argv)7 int  main(int  argc, char**  argv)
8 {
9     int  c = theFoo.getValue();
10 
11     /* check the counter on the library object
12      * it must have been called first, and only once
13      */
14     if (c != 1) {
15         printf("KO (counter(shared) == %d, expected 1)\n", c);
16         return 1;
17     }
18 
19     /* check the counter on the executable object,
20      * it must have been called second, and only once
21      */
22     c = theFoo2.getValue();
23     if (c != 2) {
24         printf("KO (counter(executable) == %d, expected 2)\n", c);
25         return 1;
26     }
27 
28     printf("OK\n");
29     return 0;
30 }
31