From 7d8741ed2df832c889c96f3d0fd699415b75f14c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 8 Apr 2013 14:15:35 +0000 Subject: [PATCH] Use API_VERSION_NUMBER for debug help API version check. This symbol is not documented but seems to be defined in all the existing versions of imagehlp.h, so use it instead of relying on a hack with checkng whether DBHLPAPI symbol is defined. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73793 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/doxygen/mainpages/const_wxusedef.h | 2 +- include/wx/msw/debughlp.h | 25 ++++++++++++++----------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/docs/doxygen/mainpages/const_wxusedef.h b/docs/doxygen/mainpages/const_wxusedef.h index 8008169882..4127c8c714 100644 --- a/docs/doxygen/mainpages/const_wxusedef.h +++ b/docs/doxygen/mainpages/const_wxusedef.h @@ -91,7 +91,7 @@ library: @itemdef{wxUSE_DATAVIEWCTRL, Use wxDataViewCtrl class.} @itemdef{wxUSE_DATEPICKCTRL, Use wxDatePickerCtrl class.} @itemdef{wxUSE_DATETIME, Use wxDateTime and related classes.} -@itemdef{wxUSE_DBGHELP, Use wxDbgHelpDLL class.} +@itemdef{wxUSE_DBGHELP, Predefine as 0 to avoid using wxDbgHelpDLL and related classes.} @itemdef{wxUSE_DC_TRANSFORM_MATRIX, Use wxDC::SetTransformMatrix() and related methods.} @itemdef{wxUSE_DEBUG_CONTEXT, Use wxDebugContext class.} @itemdef{wxUSE_DEBUG_NEW_ALWAYS, See @ref overview_debugging} diff --git a/include/wx/msw/debughlp.h b/include/wx/msw/debughlp.h index cdfaae6250..5c5d7b5b07 100644 --- a/include/wx/msw/debughlp.h +++ b/include/wx/msw/debughlp.h @@ -20,18 +20,21 @@ #endif // __WXWINCE__ #include "wx/msw/private.h" -// we need to determine whether we have the declarations for the function in -// debughlp.dll version 5.81 (at least) and we check for DBHLPAPI to test this -// -// reasons: -// - VC6 version of imagehlp.h doesn't define it -// - VC7 one does -// - testing for compiler version doesn't work as you can install and use -// the new SDK headers with VC6 -// -// in any case, the user may override by defining wxUSE_DBGHELP himself +// All known versions of imagehlp.h define API_VERSION_NUMBER but it's not +// documented, so deal with the possibility that it's not defined just in case. +#ifndef API_VERSION_NUMBER + #define API_VERSION_NUMBER 0 +#endif + +// wxUSE_DBGHELP is a bit special as it is not defined in wx/setup.h and we try +// to auto-detect whether we should be using debug help API or not ourselves +// below. However if the auto-detection fails, you can always predefine it as 0 +// to avoid even trying. #ifndef wxUSE_DBGHELP - #ifdef DBHLPAPI + // The version of imagehlp.h from VC6 (7) is too old and is missing some + // required symbols while the version from VC7 (9) is good enough. As we + // don't know anything about version 8, don't use it unless we can test it. + #if API_VERSION_NUMBER >= 9 #define wxUSE_DBGHELP 1 #else #define wxUSE_DBGHELP 0 -- 2.47.2