void LibMain() { // NOTE: nothing is inited yet including memory allocators Init0(); uint8_t* mem = (uint8_t*)ReserveMemPages(MEMCHUNK_SIZE * MEMCHUNK_COUNT); MEM_ZERO(&PermanentAlloc, 0); PermanentAlloc.at = mem; PermanentAlloc.begin = mem; PermanentAlloc.end = mem + MEMCHUNK_SIZE; Mems = PUSH_ALLOC(&PermanentAlloc, memories, 1); Mems->ChunksBegin = mem; Mems->ChunksOwned[0] = 1; // NOTE: permanent alloc // NOTE: memory allocators are available Init1(); UserMain(); TearDown(); } #ifdef _WIN32 int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) { LibMain(); return 0; } #else int main() { LibMain(); return 0; } #endif