Skip to content

Commit 5633306

Browse files
authored
winit-win32: Fix ABI mismatch in INIT_MAIN_THREAD_ID
Fixes #4435.
1 parent de78ffd commit 5633306

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

winit-win32/src/event_loop.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -528,9 +528,11 @@ fn main_thread_id() -> u32 {
528528
//
529529
// See: https://doc.rust-lang.org/stable/reference/abi.html#the-link_section-attribute
530530
#[unsafe(link_section = ".CRT$XCU")]
531-
static INIT_MAIN_THREAD_ID: unsafe fn() = {
532-
unsafe fn initer() {
533-
unsafe { MAIN_THREAD_ID = GetCurrentThreadId() };
531+
static INIT_MAIN_THREAD_ID: unsafe extern "C" fn() = {
532+
unsafe extern "C" fn initer() {
533+
unsafe {
534+
MAIN_THREAD_ID = GetCurrentThreadId();
535+
}
534536
}
535537
initer
536538
};

0 commit comments

Comments
 (0)