mirror of
https://github.com/autc04/Retro68.git
synced 2024-11-26 22:51:01 +00:00
properly call global destructors
This commit is contained in:
parent
b3dcb7f981
commit
836a8acb7b
@ -48,6 +48,7 @@
|
||||
|
||||
void Retro68Relocate();
|
||||
void Retro68CallConstructors();
|
||||
void Retro68CallDestructors();
|
||||
void Retro68FreeGlobals();
|
||||
|
||||
#define RETRO68_RELOCATE() RETRO68_CALL_UNRELOCATED(Retro68Relocate,())
|
||||
|
@ -223,6 +223,19 @@ void Retro68CallConstructors()
|
||||
}
|
||||
}
|
||||
|
||||
void Retro68CallDestructors()
|
||||
{
|
||||
char *p = (char*)&__fini_section;
|
||||
char *e = (char*)&__fini_section_end;
|
||||
p += 2;
|
||||
while( p < e )
|
||||
{
|
||||
(*(voidFunction)(*(long*)p))();
|
||||
p += 6;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Retro68FreeGlobals()
|
||||
{
|
||||
if(relocState.bssPtr != (Ptr) -1)
|
||||
|
@ -33,6 +33,7 @@ int main(int argc, char* argv[]);
|
||||
void _start()
|
||||
{
|
||||
RETRO68_RELOCATE();
|
||||
atexit(&Retro68CallDestructors);
|
||||
Retro68CallConstructors();
|
||||
|
||||
int result;
|
||||
|
Loading…
Reference in New Issue
Block a user