ezEngine  Milestone 9
ApplicationEntryPoint_posix.h
Go to the documentation of this file.
1 
2 #pragma once
3 
5 
6 
8 #define EZ_CONSOLEAPP_ENTRY_POINT EZ_APPLICATION_ENTRY_POINT
9 
10 
15 #define EZ_APPLICATION_ENTRY_POINT(AppClass, ...) \
16  static char appBuffer[sizeof(AppClass)]; /* Not on the stack to cope with smaller stacks */ \
17  \
18  int main(int argc, const char** argv) \
19  { \
20  \
21  AppClass* pApp = new (appBuffer) AppClass(__VA_ARGS__); \
22  pApp->SetCommandLineArguments((ezUInt32)argc, argv); \
23  ezRun(pApp); /* Life cycle & run method calling */ \
24  const int iReturnCode = pApp->GetReturnCode(); \
25  if (iReturnCode != 0) \
26  { \
27  std::string text = pApp->TranslateReturnCode(); \
28  if (!text.empty()) \
29  printf("Return Code: '%s'\n", text.c_str()); \
30  } \
31  pApp->~AppClass(); \
32  memset(pApp, 0, sizeof(AppClass)); \
33  return iReturnCode; \
34  }
35