|
|
On 4/20/23 22:46 imm wrote:
On Thu, 20 Apr 2023, 20:48
Albrecht Schlosser wrote:
I installed current MinGW today and my header files are
version 5.4.2 and include the guard '#if (_WIN32_IE >=
0x0500)' and the build works well out of the box.
This is only an observation on my new installation, it
doesn't mean that we should not "fix" it though...
That's interesting - though I don't think it's
the guards that are really the problem, in fact I think
they're probably correct.
Rather I think the problem is that the toolchain
doesn't seem to actually to be setting them at all so...
I made some tests, and I found that the bare toolchain (i.e.
preprocessor + compiler) doesn't set _WIN32_IE by default. It's not
defined if I compile an otherwise "empty" source file w/o other
includes (using MinGW-w64 cross compiler on Linux). However, if I
'#include <windows.h>' it's "magically" defined.
There are also other header files that set it to a "minimal" value
if it's not defined.
FWIW, I think that mingw64 toolchain does seem
to be setting them, though it's headers don't seem to have
them anyway.
The msvc tools do set the macros, of course...
I think setting them (as in my example) might
still be a valid solution...?
The question is where to set them best. In my version of
<windows.h> they are set depending on other defines like
_WIN32_WINNT etc. or just to a minimal value.
I propose to define _WIN32_IE (as in your example) right before
'#include <shlobj.h>' to avoid other potential side effects.
Please test attached diff if it works for you.
There's one issue with this patch though: it could happen that it
would #undef _WIN32_IE if it's not defined. Is this acceptable or
would it perhaps issue compiler warnings? I tested such a case with
'gcc -Wall -W -Wpedantic -Wextra' and didn't get warnings, but I
don't know if the standard "allows" it and didn't test with MS
compilers. We could make sure that this doesn't happen with another
#if defined(_WIN32_IE) but if it's not necessary we could just use
my patch as-is.
I'd appreciate comments and/or better solutions.
Ian, if you test the patch and it works, would it be OK if I
committed it?
--
You received this message because you are subscribed to the Google Groups "fltk.coredev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkcoredev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkcoredev/b83cd371-199d-ea4c-0029-44e3279cc14d%40online.de.
[ Direct Link to Message ] | |
|
| |