added wxBuildOptions and check that they are the same for the program and the library on startup

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15409 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2002-05-07 19:56:43 +00:00
parent c924182a96
commit 090a6d7af9
3 changed files with 118 additions and 14 deletions

View File

@@ -59,6 +59,11 @@
#include "wx/mac/private.h" // includes mac headers
#endif
// private functions prototypes
#ifdef __WXDEBUG__
static void LINKAGEMODE SetTraceMasks();
#endif // __WXDEBUG__
// ===========================================================================
// implementation
// ===========================================================================
@@ -67,21 +72,17 @@
// initialization and termination
// ----------------------------------------------------------------------------
#ifdef __WXDEBUG__
static void LINKAGEMODE SetTraceMasks()
{
wxString mask;
if ( wxGetEnv(wxT("WXTRACE"), &mask) )
{
wxStringTokenizer tkn(mask, wxT(","));
while ( tkn.HasMoreTokens() )
wxLog::AddTraceMask(tkn.GetNextToken());
}
}
#endif
wxAppBase::wxAppBase()
{
// this function is defined by IMPLEMENT_APP() macro in the user code
extern const wxBuildOptions& wxGetBuildOptions();
if ( !CheckBuildOptions(wxGetBuildOptions()) )
{
wxLogFatalError(_T("Mismatch between the program and library build ")
_T("versions detected."));
}
wxTheApp = (wxApp *)this;
#if WXWIN_COMPATIBILITY_2_2
@@ -348,8 +349,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)
{