Merge topic 'mingw-strftime-crash' into release-3.22

992e6d7c5d mingw: fix calling convention for strftime()

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !6762
This commit is contained in:
Brad King
2021-12-01 14:33:03 +00:00
committed by Kitware Robot

View File

@@ -197,7 +197,7 @@ std::string cmTimestamp::AddTimestampComponent(char flag,
#ifdef __MINGW32__
/* See a bug in MinGW: https://sourceforge.net/p/mingw-w64/bugs/793/. A work
* around is to try to use strftime() from ucrtbase.dll. */
using T = size_t(WINAPI*)(char*, size_t, const char*, const struct tm*);
using T = size_t(__cdecl*)(char*, size_t, const char*, const struct tm*);
auto loadUcrtStrftime = []() -> T {
auto handle =
LoadLibraryExA("ucrtbase.dll", nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32);