Back to index

cell-binutils  2.17cvs20070401
client.c
Go to the documentation of this file.
00001 #include <stdio.h>
00002 
00003 extern int var;
00004 extern void (*func_ptr)(void);
00005 extern void print_var (void);
00006 extern void print_foo (void);
00007 extern int foo;
00008 extern int var2[2];
00009 
00010 typedef struct
00011 {
00012   int *   var;
00013   void (* func_ptr)(void);
00014 }
00015 TEST;
00016 
00017 TEST xyz = { &var, print_var };
00018 
00019 int
00020 main (void)
00021 {
00022   print_var ();
00023 
00024   printf ("We see var = %d\n", var);
00025   printf ("Setting var = 456\n");
00026 
00027   var = 456;
00028 
00029   print_var ();
00030   printf ("We see var = %d\n\n", var);
00031 
00032   var = 90;
00033   print_var ();
00034   printf ("We see var = %d\n\n", var);
00035 
00036   print_foo ();
00037   printf ("We see foo = %d\n", foo);
00038   printf ("Setting foo = 19\n");
00039   foo = 19;
00040   print_foo ();
00041   printf ("We see foo = %d\n\n", foo);
00042   fflush (stdout);
00043 
00044   printf ("Calling dllimported function pointer\n");
00045   func_ptr ();
00046 
00047   printf ("Calling functions using global structure\n"); 
00048   xyz.func_ptr ();
00049   * xyz.var = 40;
00050   xyz.func_ptr ();
00051 
00052   printf ("We see var2[0] = %d\n\n", var2[0]);
00053 
00054   return 0;
00055 }