NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
global_destructor_chain.c
Go to the documentation of this file.
1#include <types.h>
2#include <runtime/global_destructor_chain.h>
4
7
16void *__register_global_object(void *pObj, dtorPtr pDtor, objectRef *pLastRef) {
18 pLastRef->mpDtor = pDtor;
19 pLastRef->mpObject = pObj;
21 return pObj;
22}
23
24
28 objectRef *pRef;
29 while ((pRef = __global_destructor_chain) != nullptr) {
31 void *pObj = pRef->mpObject;
32 pRef->mpDtor(pObj, -1);
33 }
34}
35
36#pragma section ".dtors$10"
37__declspec(section ".dtors$10") __declspec(weak)
38 extern void * const __destroy_global_chain_reference = __destroy_global_chain;
void(* dtorPtr)(void *, int)
Destructor function pointer.
objectRef * __global_destructor_chain
The global object chain.
void * __register_global_object(void *pObj, dtorPtr pDtor, objectRef *pLastRef)
Registers a global object for later destruction.
void __destroy_global_chain()
Destroys all constructed global objects.
Global destruction chain entry.
dtorPtr mpDtor
A pointer to the object's default destructor.
struct objectRef * mpLastObject
A pointer to the previously generated objectRef.
void * mpObject
A pointer to the object.