From 5a4e11dd3fe7d9d39eeb2b712f18079ee81cb804 Mon Sep 17 00:00:00 2001 From: Stefanus Du Toit Date: Tue, 28 Apr 2009 16:37:58 +0000 Subject: [PATCH] Fix choice of version of Windows callback to use to consider not only the Visual Studio version, but also the Windows SDK version. Patch by Tareq Siraj. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@70299 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/System/Win32/DynamicLibrary.inc | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/System/Win32/DynamicLibrary.inc b/lib/System/Win32/DynamicLibrary.inc index 3c35e6c9695..1ddf6cea0b3 100644 --- a/lib/System/Win32/DynamicLibrary.inc +++ b/lib/System/Win32/DynamicLibrary.inc @@ -19,6 +19,10 @@ #include #endif +#ifdef _MSC_VER + #include +#endif + #ifdef __MINGW32__ #if (HAVE_LIBIMAGEHLP != 1) #error "libimagehlp.a should be present" @@ -44,7 +48,14 @@ static std::vector OpenedHandles; #endif extern "C" { -#if !defined(_MSC_VER) || _MSC_VER < 1500 +// Use old callback if: +// - Not using Visual Studio +// - Visual Studio 2005 or earlier but only if we are not using the Windows SDK +// or Windows SDK version is older than 6.0 +// Use new callback if: +// - Newer Visual Studio (comes with newer SDK). +// - Visual Studio 2005 with Windows SDK 6.0+ +#if !defined(_MSC_VER) || _MSC_VER < 1500 && (!defined(VER_PRODUCTBUILD) || VER_PRODUCTBUILD < 6000) static BOOL CALLBACK ELM_Callback(PSTR ModuleName, ModuleBaseType ModuleBase, ULONG ModuleSize,