On Fri, 18 Oct 2024, Pali Rohár wrote:
Liu Hao presented another option in the discussion as well - we could also
define __MSVCRT_VERSION__ to another value inbetween, as it currently is
0x700 for msvcr70.dll, we could set it to 0x7FF, so that existing
comparisons with <= and >= behave mostly the same as before, while we can
explicitly check for whether we mean msvcrt.dll or msvcr70.dll in the places
where we want to.
0x7FF has drawback, that <= and >= does not work for symbols available
in Vista+ msvcrt.dll but which are not available in msvcr70.dll and
msvcr71.dll.
Yes, if we'd use 0x7FF we would still need to explicitly check for 0x7FF,
e.g. (== 0x7FF && vista) || (>= 0x800).
But you're right that technically, msvcrt.dll is more of a 6.0 than a 7.0
msvcrt (although it has gotten many additions on top of the original one
from MSVC 6.0). I guess we could use 0x6FF as well, to allow us to
distinguish that we mean msvcrt.dll as shipped with an OS, including
possibly all the new stuff that come with it in newer versions, rather than
the strict msvcrt.dll from MSVC 6.0.
It is needed to have special value (like 0x6FF) for __MSVCRT_VERSION__
when doing system version check? Because at the same time it is always
needed to check also for _WIN32_WINNT.
As you pointed out, adding more values or macros just make it more
complex. And another possible value for __MSVCRT_VERSION__ just increase
complexity too.
So in my opinion reusing 0x600 with _WIN32_WINNT could be enough:
#if (__MSVCRT_VERSION__ == 0x600 && _WIN32_WINNT >= 0x0600)
I think that special value like 0x6FF just increase complexity and still
it would be needed to write code as:
#if (__MSVCRT_VERSION__ == 0x6FF && _WIN32_WINNT >= 0x0600)
Yes, it doesn't change anything wrt complexity, we'd still need the same
amount of conditions and everything.
It's only about whether we want to be able to distinguish between strictly
the MSVC 6.0 msvcrt.dll and the newer OS-provided ones.
You may be right that we don't need to distinguish that, as the
_WIN32_WINNT checks already give that aspect.
In any case, we'd need to revisit all the existing version checks, it only
changes what version numbers we'd put into those checks.
// Martin
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public