[LLVMdev] VS2005 compatibility

Don Williamson don.williamson at yahoo.com
Tue Nov 8 07:38:55 PST 2011


In the v7.0 SDK I see _WIN32_WINNT defined in several places:

winresrc.h0x0500 if not defined already (Windows 2000)
sdkddkver.h0x0601 if not defined already (Windows 7)
objbase.hSet based on NTDDI_VERSION, if not defined already
objidl.hSimiler to objbase.h

sdkddkver.h is included by windows.h in the v7.0 SDK.

With SP1 VC2005, it's defined as 0x0500 in only one place (winresrc.h).

So it looks like my build (using cmake) is not picking up the installed v7.0 SDK. This can be achieved by running a tool in the WSDK that makes your version "current" (it modifies the visual studio global include directories).

However, that's kind of moot since you can install VS2005 and not update to the latest WSDK. In fact, I only updated it because I was after GPUView.

Various MSDN documents say that if you want to compile for a minimum OS version then you need to define _WIN32_WINNT to be that version:

http://msdn.microsoft.com/en-us/library/aa383745(v=vs.85).aspx

However, the code doesn't want to do this - it wants to check to see if certain functions are available at runtime and choose the best option available to it. But in order to write code that does that, it needs access to certain API structures to define the function signatures.

So to make this compile across all Windows platforms it needs to check to see if _WIN32_WINNT is below 0x0600 (Windows Vista) and take the same path as __MINGW32__. Or you require that to build in VS2005 you need the latest WSDK installed.

Cheers,
- Don

----- Original Message -----
From: Aaron Ballman <aaron at aaronballman.com>
To: Don Williamson <don.williamson at yahoo.com>
Cc: Francois Pichet <pichet2000 at gmail.com>; "llvmdev at cs.uiuc.edu" <llvmdev at cs.uiuc.edu>
Sent: Tuesday, November 8, 2011 2:48 PM
Subject: Re: [LLVMdev] VS2005 compatibility

On Tue, Nov 8, 2011 at 8:42 AM, Don Williamson <don.williamson at yahoo.com> wrote:
> Hi Francois,
>
> I have all licensed versions of VS at my disposal (the benefits of being a former MS employee) but I'm currently using VS2005 due to specific technical reasons that I can't disclose.
>
> The "Getting Started" page states support of 2005 SP1 which, if it's not being maintained, is not true and should be updated.

I don't know about VS support being deprecated, but I'm more curious
as to what the issue is since you're using the latest Windows SDK.
That code should compile only for Vista+ SDKs, and should fallback on
the old critical section code for XP and lower.  There's nothing
compiler specific about it -- just platform SDK specific.  At least,
that was the intent.

~Aaron





More information about the llvm-dev mailing list