mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-31 03:40:32 -06:00
mingw: fix calling convention for strftime()
`strftime` uses `__cdecl` and not `__stdcall`. This was exposed by
refactoring in commit 26c9fbab46 (MINGW-w64: Fix string(TIMESTAMP) build
on 32bits, 2021-11-16, v3.22.0~1^2).
This fixes a crash creating a timestamp with clang+mingw-w64 targeting x86.
Fixes: #22939
This commit is contained in:
committed by
Brad King
parent
5109a22d61
commit
992e6d7c5d
@@ -197,7 +197,7 @@ std::string cmTimestamp::AddTimestampComponent(char flag,
|
|||||||
#ifdef __MINGW32__
|
#ifdef __MINGW32__
|
||||||
/* See a bug in MinGW: https://sourceforge.net/p/mingw-w64/bugs/793/. A work
|
/* 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. */
|
* 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 loadUcrtStrftime = []() -> T {
|
||||||
auto handle =
|
auto handle =
|
||||||
LoadLibraryExA("ucrtbase.dll", nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32);
|
LoadLibraryExA("ucrtbase.dll", nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32);
|
||||||
|
|||||||
Reference in New Issue
Block a user