FreeBASIC  0.91.0
fbrt0.c
Go to the documentation of this file.
1 /* FB runtime initialization and cleanup */
2 
3 #include "../fb.h"
4 
5 /* note: they must be static, or shared libraries in Linux would reuse the
6  same function */
7 
8 /*:::::*/
9 static void fb_hDoInit( void ) /* __attribute__((constructor)) */;
10 static void fb_hDoInit( void )
11 {
12  /* the last to be defined, the first that will be called */
13  fb_hRtInit( );
14 }
15 
16 /*:::::*/
17 static void fb_hDoExit( void ) /* __attribute__((destructor)) */;
18 static void fb_hDoExit( void )
19 {
20  /* the last to be defined, the last that will be called */
21 
22  fb_hRtExit( );
23 }
24 
25 /* This puts the init/exit global ctor/dtor for the rtlib in the sorted ctors/dtors
26  section. A named section of .?tors.65435 = Priority(100) */
27 
28 #ifdef HOST_DARWIN
29 
30 static void * priorityhDoInit __attribute__((section(".ctors.65435,"), used)) = fb_hDoInit;
31 static void * priorityhDoExit __attribute__((section(".dtors.65435,"), used)) = fb_hDoExit;
32 
33 #else
34 
35 static void * priorityhDoInit __attribute__((section(".ctors.65435"), used)) = fb_hDoInit;
36 static void * priorityhDoExit __attribute__((section(".dtors.65435"), used)) = fb_hDoExit;
37 
38 #endif