On Fri, 11 Oct 2024, LIU Hao wrote:

在 2024-10-11 18:30, Martin Storsjö 写道:
I wonder if the right solution here would be to amend the __MSVCRT_VERSION__ checks with checks for _WIN32_WINNT; if _WIN32_WINNT is set to a new enough version, declarations are visible for functions that only exist in new enough versions. And if you want to target older versions, just don't call those functions (and define _WIN32_WINNT to a lower version if you want to get the errors for it early enough).

Does it make any sense to dedicate a version number for MSVCRT, for example, `#define __MSVCRT_VERSION__ 0x07FF` ?

Hm, interesting - as that number is < 0x800, it probably could behave mostly right in many cases.

There's risk that this can affect code which checks for 0x700 explicitly; then I would prefer your second option. I am assuming that in practice the use of MSVCR7[01] is rare.

Yes, there's maybe a bit of risk for that.

We could of course consider going in such a direction as a low-urgency, later task, but I think there can be some widespread assumption/hardcoding of 0x700 in places.

I'll post a patch to add the immediate solution I suggested above, as a more high urgency fix though.

// Martin

_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to