diff options
-rw-r--r-- | c/main.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -21,6 +21,10 @@ #define YMAIN CW_USEDEFAULT #endif +/* Exit gracefully on uncaught exception. */ +static void OnTerminate() noexcept; +static auto unused = std::set_terminate(OnTerminate); + /* main.cpp defines all global (non-template) variables used in the * program. `extern' is used to access them from other files, when * need be. */ @@ -72,7 +76,7 @@ static INT_PTR CALLBACK AboutDlgProc(HWND, UINT, WPARAM, LPARAM); /* Try to style application according to current Windows theme. */ static void UpdateTheme(); -static void OnTerminate() noexcept +void OnTerminate() noexcept { const wchar_t* what = L"an exception"; WcharPtr why; @@ -104,9 +108,6 @@ int WINAPI WinMain(const HINSTANCE hInstance, const HINSTANCE, char* const, cons { setbuf(stdout, nullptr); - /* Exit gracefully on uncaught exception. */ - std::set_terminate(OnTerminate); - /* Initialize Prolog. */ const char* argv[] = {"EpisodeBrowser", nullptr}; if (!PL_initialise(1, const_cast<char**>(argv))) |