From 8c9f622ab50a06a8223a2e8ad697f9739f61749e Mon Sep 17 00:00:00 2001 From: KeybadeBlox Date: Fri, 9 Jan 2026 21:06:28 -0500 Subject: [PATCH] Decompiling C++: Add static object initialization --- documentation/decompilingcpp.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/documentation/decompilingcpp.md b/documentation/decompilingcpp.md index 8fe24a7..eaf73cb 100644 --- a/documentation/decompilingcpp.md +++ b/documentation/decompilingcpp.md @@ -117,7 +117,13 @@ its lifetime (e.g. it goes out of scope), which can lead to inclusion in exception handling code or just being called at the end of a code block even if the source code doesn't invoke it explicitly. This automatic resource management is often called part of C++'s RAII (resource acquisition is -initialization) design. +initialization) design. Lastly, objects with constructors that exist for the +lifetime of the program (e.g. global variables or static local variables) have +special treatment, having their constructor run before `main()` and their +destructor run on program exit. In an Xbox game specifically, the `_cinit()` +function called by `mainXapiStartup()` walks a list of function pointers, with +each called function calling an object's constructor and registering its +destructor with `atexit()`. Virtual methods are methods that can be overridden on child classes. They're not called directly, but instead called through a hidden first member that