3 * - By John Hodge (thePowersGang)
6 * - Miscelanious functions
10 extern "C" int SoMain()
16 extern "C" void __cxa_pure_virtual()
21 extern "C" void __gxx_personality_v0()
23 // TODO: Handle __gxx_personality_v0 somehow
30 void (*destructor) (void *);
33 } __cxa_atexit_funcs[MAX_ATEXIT];
34 static int __cxa_atexit_func_count;
36 extern "C" int __cxa_atexit(void (*destructor) (void *), void *arg, void *dso_handle)
38 if( __cxa_atexit_func_count == MAX_ATEXIT )
43 __cxa_atexit_funcs[__cxa_atexit_func_count].destructor = destructor;
44 __cxa_atexit_funcs[__cxa_atexit_func_count].arg = arg;
45 __cxa_atexit_funcs[__cxa_atexit_func_count].dso_handle = dso_handle;
46 __cxa_atexit_func_count ++;
50 extern "C" void __cxa_finalize(void *f)
54 for( int i = __cxa_atexit_func_count; i --; )
56 if( __cxa_atexit_funcs[i].dso_handle == f )
58 __cxa_atexit_funcs[i].destructor(__cxa_atexit_funcs[i].arg);
60 &__cxa_atexit_funcs[i],
61 &__cxa_atexit_funcs[i+1],
62 (__cxa_atexit_func_count-i)*sizeof(__cxa_atexit_funcs[0])
65 __cxa_atexit_func_count --;
71 for( int i = __cxa_atexit_func_count; i --; )
73 __cxa_atexit_funcs[i].destructor(__cxa_atexit_funcs[i].arg);
75 __cxa_atexit_func_count = 0;