Compiling clang on Windows/TDM-GCC 4.8.1-3 (MinGW32)

Hi,
The latest trunk can’t be built with GCC 4.8.1-3 on Windows (MinGW, TDM build) - missing registery definitions
Applying the attached patch fixs this

Thanks,

mingw32-reg-def.patch (485 Bytes)

Inst't there an include we can use?

Cheers,
Rafael

The header file is included indirectly (<winnt.h>). However, the definitions are not visible since _WIN32_WINNT is set to a value lower than 0x0502
Attached is a patch to the CMakeLists.txt file that adds -D_WIN32_WINNT=0x0502 in case of MinGW and WIN32 conditions are met

Thanks

mingw32-reg.patch (478 Bytes)

Not sure which one is better. Aaron, any thoughts?

Cheers,
Rafael

I think we should be setting WINVER and _WIN32_WINNT to
_WIN32_WINNT_WS03 (0x0502) in WindowsSupport.h. We currently set it to
0x0501, and it sounds like we want to update it. I don't think that
requiring Win XP SP 2 will be that problematic in practice, but we
should be aware that we would be changing the minimum required version
of Windows (slightly).

~Aaron

I think _WIN32_WINNT is the right approach, since we should not duplicate content from header file.
_WIN32_WINNT=0x0502 means Windows server 2003 or later, which is quite antique anyhow.

http://msdn.microsoft.com/en-us/library/6sehtctf.aspx

Yaron

Given that there are approximately *two* places where we include windows.h
/ winnt.h, I think we should define the macro in the .cpp file rather than
adding a flag for every TU. It appears we don't define WINVER & co anywhere
else, so let's not change that practice.

I also don't think this needs to be MinGW specific. It's just that the Win7
/ Win8 SDKs we use don't support pre-XP OSs with the #ifndef directives
that MinGW appears to use.

> The header file is included indirectly (<winnt.h>). However, the
> definitions
> are not visible since _WIN32_WINNT is set to a value lower than 0x0502
> Attached is a patch to the CMakeLists.txt file that adds
> -D_WIN32_WINNT=0x0502 in case of MinGW and WIN32 conditions are met

Not sure which one is better. Aaron, any thoughts?

Given that there are approximately *two* places where we include windows.h /
winnt.h, I think we should define the macro in the .cpp file rather than
adding a flag for every TU. It appears we don't define WINVER & co anywhere
else, so let's not change that practice.

We already have this macro in WindowsSupport.h which is included all
the places this would matter. I would rather we not spread
_WIN32_WINNT definitions in multiple places. Also, it was my
understanding that when you define that, you really should define
WINVER as well for Win32 API declaration consistency. It may not be
strictly required, but it is suggested by MSDN.

I also don't think this needs to be MinGW specific. It's just that the Win7
/ Win8 SDKs we use don't support pre-XP OSs with the #ifndef directives that
MinGW appears to use.

Agreed that this does not need to be MinGW-specific.

~Aaron

I use clang [2] on win7 using MinGW32 [1]
I modified \MinGW\include\windef.h and changed the WINVER asignment:
--8X----------------------------------------------------------------------------------------------
#ifndef WINVER
// #define WINVER 0x0400
#define WINVER 0x0502
/*
  * If you need Win32 API features newer the Win95 and WinNT then you must
  * define WINVER before including windows.h or any other method of including
  * the windef.h header.
  */
#endif
--8X----------------------------------------------------------------------------------------------

Other clang/gcc users may adjust this value for her needs different than me and you.

My question:
Would it be the best way for clang to read this definition from the local windef.h file and use this local adjusted value?

Ulrich Schmidt.

[1]: http://sourceforge.net/projects/mingw/
[2]: http://llvm.org/releases/3.5.0/LLVM-3.5.0-win32.exe