Usermode/crt0 - Cleaned up and added ctrbegin/crtend for .ctors support
[tpg/acess2.git] / Usermode / Libraries / crt0.o_src / crt0.c
1 /*
2  * Acess2
3  * - C Runtime 0 Common Code
4  */
5
6 typedef void    (*exithandler_t)(void);
7 typedef void    (*constructor_t)(void);
8
9 exithandler_t   _crt0_exit_handler;
10 extern constructor_t    _crtbegin_ctors[];
11
12 int start(int argc, char *argv[], char **envp)
13 {
14          int    i;
15          int    rv;
16         
17         for( i = 0; _crtbegin_ctors[i]; i ++ )
18                 _crtbegin_ctors[i]();
19
20         rv = main(argc, argv, envp);
21         
22         if( _crt0_exit_handler )
23                 _crt0_exit_handler();
24         
25         return rv;
26 }

UCC git Repository :: git.ucc.asn.au