From 5b9931456f595b0a2163fabb65dceac99e0e220f Mon Sep 17 00:00:00 2001 From: Anders Leino Date: Wed, 8 Jan 2025 08:30:18 +0200 Subject: Add backtraces to examples (#5973) * examples: Log stack trace on exceptions For now, this is only implemented on Windows. This helps to address #5520. * examples: Print log file if there is any * format code --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> Co-authored-by: Yong He --- tools/platform/window.h | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) (limited to 'tools/platform') diff --git a/tools/platform/window.h b/tools/platform/window.h index 4ff9e245f..654f0daab 100644 --- a/tools/platform/window.h +++ b/tools/platform/window.h @@ -237,33 +237,19 @@ public: #define GFX_DUMP_LEAK _CrtDumpMemoryLeaks(); #endif #endif + +#endif + #ifndef GFX_DUMP_LEAK #define GFX_DUMP_LEAK #endif -#define PLATFORM_UI_MAIN(APPLICATION_ENTRY) \ - int __stdcall wWinMain( \ - void* /*instance*/, \ - void* /* prevInstance */, \ - void* /* commandLine */, \ - int /*showCommand*/ \ - ) \ - { \ - platform::Application::init(); \ - auto result = APPLICATION_ENTRY(0, nullptr); \ - platform::Application::dispose(); \ - GFX_DUMP_LEAK \ - return result; \ - } - -#else #define PLATFORM_UI_MAIN(APPLICATION_ENTRY) \ - int main(int argc, char** argv) \ + int exampleMain(int argc, char** argv) \ { \ platform::Application::init(); \ auto rs = APPLICATION_ENTRY(argc, argv); \ platform::Application::dispose(); \ + GFX_DUMP_LEAK \ return rs; \ } - -#endif -- cgit v1.2.3