]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/appcmn.cpp
added rtti info (python problem)
[wxWidgets.git] / src / common / appcmn.cpp
index 314a7654eb7f4ca830d5c843d318f4c536fbb288..6a20f958789711a428228f3e94e1554b0e9d3301 100644 (file)
   #include  "wx/mac/private.h"  // includes mac headers
 #endif
 
+// private functions prototypes
+#ifdef __WXDEBUG__
+    static void LINKAGEMODE SetTraceMasks();
+#endif // __WXDEBUG__
+
 // ===========================================================================
 // implementation
 // ===========================================================================
 // initialization and termination
 // ----------------------------------------------------------------------------
 
-#ifdef __WXDEBUG__
-static void LINKAGEMODE SetTraceMasks()
+wxAppBase::wxAppBase()
 {
-    wxString mask;
-    if ( wxGetEnv(wxT("WXTRACE"), &mask) )
+    // this function is defined by IMPLEMENT_APP() macro in the user code
+    extern const wxBuildOptions& wxGetBuildOptions();
+
+    if ( !CheckBuildOptions(wxGetBuildOptions()) )
     {
-        wxStringTokenizer tkn(mask, wxT(","));
-        while ( tkn.HasMoreTokens() )
-            wxLog::AddTraceMask(tkn.GetNextToken());
+        wxLogFatalError(_T("Mismatch between the program and library build ")
+                        _T("versions detected."));
     }
-}
-#endif
 
-wxAppBase::wxAppBase()
-{
     wxTheApp = (wxApp *)this;
 
 #if WXWIN_COMPATIBILITY_2_2
@@ -249,7 +250,9 @@ void wxAppBase::OnInitCmdLine(wxCmdLineParser& parser)
             wxCMD_LINE_SWITCH,
             _T(""),
             OPTION_VERBOSE,
-            gettext_noop("generate verbose log messages")
+            gettext_noop("generate verbose log messages"),
+            wxCMD_LINE_VAL_NONE,
+            0x0
         },
 #endif // wxUSE_LOG
 
@@ -259,7 +262,8 @@ void wxAppBase::OnInitCmdLine(wxCmdLineParser& parser)
             _T(""),
             OPTION_THEME,
             gettext_noop("specify the theme to use"),
-            wxCMD_LINE_VAL_STRING
+            wxCMD_LINE_VAL_STRING,
+            0x0
         },
 #endif // __WXUNIVERSAL__
 
@@ -272,12 +276,20 @@ void wxAppBase::OnInitCmdLine(wxCmdLineParser& parser)
             _T(""),
             OPTION_MODE,
             gettext_noop("specify display mode to use (e.g. 640x480-16)"),
-            wxCMD_LINE_VAL_STRING
+            wxCMD_LINE_VAL_STRING,
+            0x0
         },
 #endif // __WXMGL__
 
         // terminator
-        { wxCMD_LINE_NONE }
+        {
+            wxCMD_LINE_NONE,
+            _T(""),
+            _T(""),
+            _T(""),
+            wxCMD_LINE_VAL_NONE,
+            0x0
+        }
     };
 
     parser.SetDesc(cmdLineDesc);
@@ -348,8 +360,39 @@ bool wxAppBase::OnCmdLineError(wxCmdLineParser& parser)
 // debugging support
 // ----------------------------------------------------------------------------
 
+/* static */
+bool wxAppBase::CheckBuildOptions(const wxBuildOptions& opts)
+{
+#define wxCMP(what)   (what == opts.m_ ## what)
+
+    bool
+#ifdef __WXDEBUG__
+    isDebug = TRUE;
+#else
+    isDebug = FALSE;
+#endif
+
+    int verMaj = wxMAJOR_VERSION,
+        verMin = wxMINOR_VERSION;
+
+    return wxCMP(isDebug) && wxCMP(verMaj) && wxCMP(verMin);
+
+#undef wxCMP
+}
+
 #ifdef  __WXDEBUG__
 
+static void LINKAGEMODE SetTraceMasks()
+{
+    wxString mask;
+    if ( wxGetEnv(wxT("WXTRACE"), &mask) )
+    {
+        wxStringTokenizer tkn(mask, wxT(","));
+        while ( tkn.HasMoreTokens() )
+            wxLog::AddTraceMask(tkn.GetNextToken());
+    }
+}
+
 // wxASSERT() helper
 bool wxAssertIsEqual(int x, int y)
 {