1 int global_a = 2;
2 
3 void
exewrite(void)4 exewrite (void)
5 {
6   global_a = 1;
7 }
8 
9 extern void dllwrite (void);
10 
11 int _stdcall
testexe_main(void * p1,void * p2,char * p3,int p4)12 testexe_main (void* p1, void *p2, char* p3, int p4)
13 {
14   dllwrite ();
15   /* We can't print or assert in a minimal app like this,
16      so use the return status to indicate if global_a
17      ended up with the correct expected value.  */
18   return 1 - global_a;
19 }
20 
21 /* We have to import something, anything at all, from
22    kernel32, in order to have the thread and process
23    base thunk routines loaded when we start running!.  */
24 extern __attribute((dllimport)) void _stdcall Sleep (unsigned int duration);
25 
26 int _stdcall
testexe_dummy(unsigned int foobar)27 testexe_dummy (unsigned int foobar)
28 {
29   Sleep (foobar);
30 }
31 
32