// clean up
// ----------------------------------------------------------------------------
-// cleanup done before destroying wxTheApp
+// cleanup done before destroying wxTheApp
static void DoCommonPreCleanup()
{
#if wxUSE_LOG
// wxEntry
// ----------------------------------------------------------------------------
-#if !defined(__WXMSW__) || !wxUSE_ON_FATAL_EXCEPTION
+// for MSW the real wxEntry is defined in msw/main.cpp
+#ifndef __WXMSW__
#define wxEntryReal wxEntry
-#endif // !(__WXMSW__ && wxUSE_ON_FATAL_EXCEPTION)
+#endif // !__WXMSW__
int wxEntryReal(int& argc, wxChar **argv)
{
+#if wxUSE_LOG
+ // Create a non-GUI log target, to be used until GUI (if any) is ready.
+ // Target will be reset by wxAppConsole::Initialize, when GUI logging will work.
+ wxLog::GetActiveTarget();
+#endif
+
// library initialization
if ( !wxEntryStart(argc, argv) )
{
wxCATCH_ALL( wxTheApp->OnUnhandledException(); return -1; )
}
-// wrap real wxEntry in a try-except block to be able to call
-// OnFatalException() if necessary
-#if defined(__WXMSW__) && wxUSE_ON_FATAL_EXCEPTION
-
-#ifdef __WXWINCE__
-// For ExitThread
-#include "wx/msw/private.h"
-#endif
-
-extern unsigned long wxGlobalSEHandler(EXCEPTION_POINTERS *pExcPtrs);
-
-int wxEntry(int& argc, wxChar **argv)
-{
- __try
- {
- return wxEntryReal(argc, argv);
- }
- __except ( wxGlobalSEHandler(GetExceptionInformation()) )
- {
-#ifdef __WXWINCE__
- ::ExitThread(3); // the same exit code as abort()
-#else
- ::ExitProcess(3); // the same exit code as abort()
-#endif
-
-#if !defined(_MSC_VER) || _MSC_VER < 1300
- // this code is unreachable but put it here to suppress warnings
- // from some compilers
- return -1;
-#endif
- }
-}
-
-#endif // __WXMSW__ && wxUSE_ON_FATAL_EXCEPTION
-
#if wxUSE_UNICODE
// as with wxEntryStart, we provide an ANSI wrapper