ezEngine  Milestone 7
ApplicationEntryPoint_win.h
Go to the documentation of this file.
1 
2 #pragma once
3 
5 
7 #define EZ_CONSOLEAPP_ENTRY_POINT(AppClass, ...) \
8  static char appBuffer[sizeof(AppClass)]; /* Not on the stack to cope with smaller stacks */ \
9  \
10  int main(int argc, const char** argv) \
11  { \
12  \
13  AppClass* pApp = new (appBuffer) AppClass(__VA_ARGS__); \
14  pApp->SetCommandLineArguments((ezUInt32) argc, argv); \
15  ezRun(pApp); /* Life cycle & run method calling */ \
16  int iReturnCode = pApp->GetReturnCode(); \
17  pApp->~AppClass(); \
18  memset(pApp, 0, sizeof(AppClass)); \
19  return iReturnCode; \
20  }
21 
26 #define EZ_APPLICATION_ENTRY_POINT(AppClass, ...) \
27  static char appBuffer[sizeof(AppClass)]; /* Not on the stack to cope with smaller stacks */ \
28  \
29  int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) \
30  { \
31  \
32  AppClass* pApp = new (appBuffer) AppClass(__VA_ARGS__); \
33  pApp->SetCommandLineArguments((ezUInt32) __argc, const_cast<const char**>(__argv)); \
34  ezRun(pApp); /* Life cycle & run method calling */ \
35  int iReturnCode = pApp->GetReturnCode(); \
36  pApp->~AppClass(); \
37  memset(pApp, 0, sizeof(AppClass)); \
38  return iReturnCode; \
39  }
40