Skip to content

Commit

Permalink
Use raw-dylib for Windows futex APIs
Browse files Browse the repository at this point in the history
This is a workaround for older mingw `synchronization` import library not working on at least some system.
  • Loading branch information
ChrisDenton authored and Mark-Simulacrum committed Apr 28, 2024
1 parent dc070bc commit 2775ae0
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion library/std/src/sys/pal/windows/c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,19 @@ compat_fn_with_fallback! {
}

#[cfg(not(target_vendor = "win7"))]
#[link(name = "synchronization")]
// Use raw-dylib to import synchronization functions to workaround issues with the older mingw import library.
#[cfg_attr(
target_arch = "x86",
link(
name = "api-ms-win-core-synch-l1-2-0",
kind = "raw-dylib",
import_name_type = "undecorated"
)
)]
#[cfg_attr(
not(target_arch = "x86"),
link(name = "api-ms-win-core-synch-l1-2-0", kind = "raw-dylib")
)]
extern "system" {
pub fn WaitOnAddress(
address: *const c_void,
Expand Down

0 comments on commit 2775ae0

Please sign in to comment.