Last of the EDs and TDs in pool should also be initialized.
[cake.git] / compiler / autoinit / initexitsets.c
blobe27f29e26bcce47dba1605bad0051ac5ea7db2de
1 /*
2 Copyright © 2009, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc: autoinit library - handle init and exit symolsets
6 */
7 #include <aros/startup.h>
8 #include <aros/symbolsets.h>
9 #include <setjmp.h>
11 #define DEBUG 0
12 #include <aros/debug.h>
14 int __noinitexitsets __attribute__((weak)) = 0;
16 DEFINESET(CTORS);
17 DEFINESET(DTORS);
18 DEFINESET(INIT);
19 DEFINESET(EXIT);
21 static void __startup_initexit(void)
23 D(bug("Entering __startup_initexit\n"));
25 if (set_open_libraries())
27 if (set_call_funcs(SETNAME(INIT), 1, 1))
29 /* ctors/dtors get called in inverse order than init funcs */
30 set_call_funcs(SETNAME(CTORS), -1, 0);
32 __startup_entries_next();
34 set_call_funcs(SETNAME(DTORS), 1, 0);
36 set_call_funcs(SETNAME(EXIT), -1, 0);
38 set_close_libraries();
40 D(bug("Leaving __startup_initexit\n"));
43 ADD2SET(__startup_initexit, program_entries, -20);