3 * - By John Hodge (thePowersGang)
6 * - Miscelanious functions
10 extern "C" int SoMain()
12 //extern void _init();
18 extern "C" void __cxa_pure_virtual()
23 extern "C" void __gxx_personality_v0()
25 // TODO: Handle __gxx_personality_v0 somehow
32 void (*destructor) (void *);
35 } __cxa_atexit_funcs[MAX_ATEXIT];
36 static int __cxa_atexit_func_count;
38 extern "C" int __cxa_atexit(void (*destructor) (void *), void *arg, void *dso_handle)
40 if( __cxa_atexit_func_count == MAX_ATEXIT )
45 __cxa_atexit_funcs[__cxa_atexit_func_count].destructor = destructor;
46 __cxa_atexit_funcs[__cxa_atexit_func_count].arg = arg;
47 __cxa_atexit_funcs[__cxa_atexit_func_count].dso_handle = dso_handle;
48 __cxa_atexit_func_count ++;
52 extern "C" void __cxa_finalize(void *f)
56 for( int i = __cxa_atexit_func_count; i --; )
58 if( __cxa_atexit_funcs[i].dso_handle == f )
60 __cxa_atexit_funcs[i].destructor(__cxa_atexit_funcs[i].arg);
62 &__cxa_atexit_funcs[i],
63 &__cxa_atexit_funcs[i+1],
64 (__cxa_atexit_func_count-i)*sizeof(__cxa_atexit_funcs[0])
67 __cxa_atexit_func_count --;
73 for( int i = __cxa_atexit_func_count; i --; )
75 __cxa_atexit_funcs[i].destructor(__cxa_atexit_funcs[i].arg);
77 __cxa_atexit_func_count = 0;