diff --git a/include/wx/app.h b/include/wx/app.h index 489194ab3b..29fda43adf 100644 --- a/include/wx/app.h +++ b/include/wx/app.h @@ -548,20 +548,14 @@ public: #define IMPLEMENT_WX_THEME_SUPPORT #endif -// define the build options object for the application which is compared to the -// one used for building the library on the program startup -#define WX_DEFINE_BUILDOPTS() \ - const wxBuildOptions& wxGetBuildOptions() \ - { \ - static wxBuildOptions s_buildOptions; \ - return s_buildOptions; \ - } - // Use this macro if you want to define your own main() or WinMain() function // and call wxEntry() from there. #define IMPLEMENT_APP_NO_MAIN(appname) \ - WX_DEFINE_BUILDOPTS() \ - wxApp *wxCreateApp() { return new appname; } \ + wxApp *wxCreateApp() \ + { \ + wxApp::CheckBuildOptions(wxBuildOptions()); \ + return new appname; \ + } \ wxAppInitializer wxTheAppInitializer((wxAppInitializerFunction) wxCreateApp); \ appname& wxGetApp() { return *(appname *)wxTheApp; } diff --git a/src/common/appcmn.cpp b/src/common/appcmn.cpp index 6a20f95878..05d7cb3bfe 100644 --- a/src/common/appcmn.cpp +++ b/src/common/appcmn.cpp @@ -74,15 +74,6 @@ 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 @@ -375,9 +366,17 @@ bool wxAppBase::CheckBuildOptions(const wxBuildOptions& opts) int verMaj = wxMAJOR_VERSION, verMin = wxMINOR_VERSION; - return wxCMP(isDebug) && wxCMP(verMaj) && wxCMP(verMin); + if ( !(wxCMP(isDebug) && wxCMP(verMaj) && wxCMP(verMin)) ) + { + wxLogFatalError(_T("Mismatch between the program and library build ") + _T("versions detected.")); + // normally wxLogFatalError doesn't return + return FALSE; + } #undef wxCMP + + return TRUE; } #ifdef __WXDEBUG__