> > 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.
Thanks for all the pointers! I would have expected that users needed to define _WIN32_WINNT to an old value for these targets. > If I understand correctly, the issue with MSVC here is only about not > supporting __attribute__((constructor)). Indeed. > It should be possible to achieve the same by storing a pointer to a function > in the suitable .CRT$XC? section. Do you mean with something as documented in [CRT Initialization][1]? How would that work in C? It seems that the pattern would exactly be covered by using pthread_once [2]. Could we use that instead? [1]: https://learn.microsoft.com/en-us/cpp/c-runtime-library/crt-initialization?view=msvc-170 [2]: https://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_once.html -- Antonin _______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public