// POSIX process startup. This file owns process-local POSIX personality initialization before main runs. #include #include #include #include extern int main(int argc, char** argv, char** envp); __declspec(dllimport) uint32_t __ntl_posix_process_start(void); __declspec(dllimport) uint32_t __ntl_posix_process_vectors(int* argcOut, char*** argvOut, char*** envpOut); // Initializes POSIX process state and exits with main's return value. void PosixStart(void) { uint32_t status = NtlInitializeExceptionRuntime(); if (status != NTLSTATUS_SUCCESS) { while (true) SysExitProcess((int32_t)status); } status = __ntl_posix_process_start(); if (status != NTLSTATUS_SUCCESS) { while (true) SysExitProcess((int32_t)status); } int argc = 0; char** argv = (char**)0; char** envp = (char**)0; status = __ntl_posix_process_vectors(&argc, &argv, &envp); if (status != NTLSTATUS_SUCCESS) { while (true) SysExitProcess((int32_t)status); } int exitCode = main(argc, argv, envp); exit(exitCode); while (true) {} }