-#ifdef __DEBUG__
- // NB: debug functions don't translate their arguments
- extern void WXDLLEXPORT wxLogDebug(const char *szFormat, ...);
-
- // first king of LogTrace is uncoditional: it doesn't check the level,
- // while the second one does nothing if all of level bits are not set
- // in wxLog::GetActive()->GetTraceMask().
- extern void WXDLLEXPORT wxLogTrace(const char *szFormat, ...);
- extern void WXDLLEXPORT wxLogTrace(wxTraceMask mask,
- const char *szFormat, ...);
-#else //!debug
- #define wxLogDebug
- #define wxLogTrace
-#endif
-
-
-// are we in 'verbose' mode?
-// (note that it's often handy to change this var manually from the
-// debugger, thus enabling/disabling verbose reporting for some
-// parts of the program only)
-WXDLLEXPORT_DATA(extern bool) g_bVerbose;
-
-// fwd decl to avoid including iostream.h here
-class ostream;
-
-// ----------------------------------------------------------------------------
-// get error code/error message from system in a portable way
-// ----------------------------------------------------------------------------
-
-// return the last system error code
-unsigned long WXDLLEXPORT wxSysErrorCode();
-// return the error message for given (or last if 0) error code
-const char* WXDLLEXPORT wxSysErrorMsg(unsigned long nErrCode = 0);
+#if wxUSE_LOG && wxUSE_LOG_DEBUG
+ DECLARE_LOG_FUNCTION(Debug);
+
+ // there is no more unconditional LogTrace: it is not different from
+ // LogDebug and it creates overload ambiguities
+ //DECLARE_LOG_FUNCTION(Trace);
+
+ // this version only logs the message if the mask had been added to the
+ // list of masks with AddTraceMask()
+ DECLARE_LOG_FUNCTION2(Trace, const wxChar *, mask);
+
+ // and this one does nothing if all of level bits are not set in
+ // wxLog::GetActive()->GetTraceMask() -- it's deprecated in favour of
+ // string identifiers
+ DECLARE_LOG_FUNCTION2(Trace, wxTraceMask, mask);
+#else //!debug || !wxUSE_LOG
+ // these functions do nothing in release builds, but don't define them as
+ // nothing as it could result in different code structure in debug and
+ // release and this could result in trouble when these macros are used
+ // inside if/else
+ //
+ // note that making wxVLogDebug/Trace() themselves (empty inline) functions
+ // is a bad idea as some compilers are stupid enough to not inline even
+ // empty functions if their parameters are complicated enough, but by
+ // defining them as an empty inline function we ensure that even dumbest
+ // compilers optimise them away
+ inline void wxLogNop() { }
+
+ #define wxVLogDebug(fmt, valist) wxLogNop()
+ #define wxVLogTrace(mask, fmt, valist) wxLogNop()
+
+ #ifdef HAVE_VARIADIC_MACROS
+ // unlike the inline functions below, this completely removes the
+ // wxLogXXX calls from the object file:
+ #define wxLogDebug(fmt, ...) wxLogNop()
+ #define wxLogTrace(mask, fmt, ...) wxLogNop()
+ #else // !HAVE_VARIADIC_MACROS
+ // note that leaving out "fmt" in the vararg functions provokes a warning
+ // from SGI CC: "the last argument of the varargs function is unnamed"
+ inline void wxLogDebug(const wxChar *fmt, ...) { wxUnusedVar(fmt); }
+ inline void wxLogTrace(wxTraceMask, const wxChar *fmt, ...) { wxUnusedVar(fmt); }
+ inline void wxLogTrace(const wxChar *, const wxChar *fmt, ...) { wxUnusedVar(fmt); }
+ #endif // HAVE_VARIADIC_MACROS/!HAVE_VARIADIC_MACROS
+#endif // debug/!debug
+
+// wxLogFatalError helper: show the (fatal) error to the user in a safe way,
+// i.e. without using wxMessageBox() for example because it could crash
+void WXDLLIMPEXP_BASE
+wxSafeShowMessage(const wxString& title, const wxString& text);