winit-win32: Fix ABI mismatch in INIT_MAIN_THREAD_ID

Fixes #4435.
This commit is contained in:
itsamine27
2025-12-16 14:50:14 +01:00
committed by Kirill Chibisov
parent ab4c6bfc82
commit 7035dd554f

View File

@@ -574,9 +574,11 @@ fn main_thread_id() -> u32 {
//
// See: https://doc.rust-lang.org/stable/reference/abi.html#the-link_section-attribute
#[link_section = ".CRT$XCU"]
static INIT_MAIN_THREAD_ID: unsafe fn() = {
unsafe fn initer() {
unsafe { MAIN_THREAD_ID = GetCurrentThreadId() };
static INIT_MAIN_THREAD_ID: unsafe extern "C" fn() = {
unsafe extern "C" fn initer() {
unsafe {
MAIN_THREAD_ID = GetCurrentThreadId();
}
}
initer
};