On Thu, 28 Dec 2023, Antonin Décimo wrote:

If we're compiling for Windows 6 (Vista, Server 2008) or later, the
GetTickCount64 [1] function is available.
Note that MSVC as of version 19.39 doesn't provide
__attribute__((constructor)), or the __typeof__ extension.

[1]: 
https://learn.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-gettickcount64

Signed-off-by: Antonin Décimo <anto...@tarides.com>
---
mingw-w64-libraries/winpthreads/src/misc.c | 29 +++++++++++++++-------
1 file changed, 20 insertions(+), 9 deletions(-)

This patch reverses a quite recent change. Please see the git commit cb7f42e05b94cbb1d94edcebdbfb47b652a45484, and discussion on this mailing list, such as https://sourceforge.net/p/mingw-w64/mailman/message/47371359/, https://sourceforge.net/p/mingw-w64/mailman/message/49958237/ and https://sourceforge.net/p/mingw-w64/mailman/message/48131379/.

The issue is that _WIN32_WINNT defaults to Win10 these days, so a default build of a toolchain won't work for older targets, which is why we agreed to do the change to try to load this function at runtime.

Most of the issues raised at that time, were around UWP/WinStore compatibility, LoadLibrary vs GetModuleHandle and all that.

If I understand correctly, the issue with MSVC here is only about not supporting __attribute__((constructor)). It should be possible to achieve the same by storing a pointer to a function in the suitable .CRT$XC? section.

// Martin

_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to