Commit Graph

1 Commits

Author SHA1 Message Date
mz
39d3ab8c7d RT-115: gta6rt --run runs the game's atexit handlers and static destructors
The mapped EXE registered atexit handlers and static destructors with the
host CRT's process-wide table, which gta6rt never runs, so they were lost.
They now go to a table of the run's own: exit() and a return from main run
it newest first (including handlers registered during exit), _cexit() runs
it and returns, and _exit/_Exit/quick_exit/ExitProcess/abort skip it, as
natively. exit/_exit/_Exit/quick_exit share an exit lock like the CRT's,
each run starts with an empty table, and a failed registration returns an
error instead of throwing into the game.

New run_tiny_atexit compares a stand-in program run natively and through
--run for 8 termination paths. Not covered yet: at_quick_exit and the
thread_local destructor callback.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 20:21:20 +00:00