FLTK logo

Re: [fltk.coredev] Re: fltk-1.4 build error in Fl_WinAPI_System_Driver.cxx with 32-bit mingw

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.coredev  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Re: Re: fltk-1.4 build error in Fl_WinAPI_System_Driver.cxx with 32-bit mingw Albrecht Schlosser Apr 21, 2023  
 
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 ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.