Appearance
aowlspt_hostboot.h
Source: abi/aowlspt_hostboot.h — 74 lines, 2 file-scope functions.
What this header owns
Reproduced verbatim from the header's own banner comment — these notes are frequently the only written record of why the subsystem is shaped the way it is.
text
aowlspt_hostboot.h — getting the client host running inside the game.
The host is a native DLL injected into `EscapeFromTarkov.exe`. Something has
to start it once it is in there, and that something cannot be nimony: the
entry point is `DllMain`, which nimony's `--app:lib` output already owns and
uses to initialise its runtime.
So a C constructor starts a thread, and the thread calls into nimony.
Two details matter and both are deliberate:
* The work happens on a *new thread*, not in the constructor. Constructors
run under the loader lock, where almost everything -- LoadLibrary, most
of the CRT, anything that might wait on another thread -- deadlocks.
`CreateThread` is one of the few calls that is safe there, and the thread
it creates does not begin running until the lock is released.
* Because it does not begin running until then, nimony's own `DllMain` has
already initialised its runtime by the time any nimony code executes.
Getting this backwards is the difference between a mod loader and a
crash-on-launch.Constants
AOWLSPT_HOSTBOOT_H
Functions
| Signature | Line |
|---|---|
DWORD WINAPI aowl_host_thread(LPVOID param) | 52 |
void aowl_host_boot(void) | 59 |

