3 * - By John Hodge (thePowersGang)
6 * - Miscelanious functions
12 extern "C" int SoMain()
14 //extern void _init();
20 extern "C" void __cxa_pure_virtual()
23 ::_SysDebug("__cxa_pure_virtual by %p", __builtin_return_address(0));
31 void (*destructor) (void *);
34 } __cxa_atexit_funcs[MAX_ATEXIT];
35 static int __cxa_atexit_func_count;
37 extern "C" int __cxa_atexit(void (*destructor) (void *), void *arg, void *dso_handle)
39 if( __cxa_atexit_func_count == MAX_ATEXIT )
44 __cxa_atexit_funcs[__cxa_atexit_func_count].destructor = destructor;
45 __cxa_atexit_funcs[__cxa_atexit_func_count].arg = arg;
46 __cxa_atexit_funcs[__cxa_atexit_func_count].dso_handle = dso_handle;
47 __cxa_atexit_func_count ++;
51 extern "C" void __cxa_finalize(void *f)
55 for( int i = __cxa_atexit_func_count; i --; )
57 if( __cxa_atexit_funcs[i].dso_handle == f )
59 __cxa_atexit_funcs[i].destructor(__cxa_atexit_funcs[i].arg);
61 &__cxa_atexit_funcs[i],
62 &__cxa_atexit_funcs[i+1],
63 (__cxa_atexit_func_count-i)*sizeof(__cxa_atexit_funcs[0])
66 __cxa_atexit_func_count --;
72 for( int i = __cxa_atexit_func_count; i --; )
74 __cxa_atexit_funcs[i].destructor(__cxa_atexit_funcs[i].arg);
76 __cxa_atexit_func_count = 0;