diff --git a/src/windows/windows_targets.rs b/src/windows/windows_targets.rs index fa0fa2fe1..30ddf643c 100644 --- a/src/windows/windows_targets.rs +++ b/src/windows/windows_targets.rs @@ -9,7 +9,8 @@ macro_rules! link_macro { // have in this repo. So instead we always link kernel32.lib and add the rest of the import // libraries below by using an empty extern block. This works because extern blocks are not // connected to the library given in the #[link] attribute. - #[link(name = "kernel32", kind = "raw-dylib")] + #[cfg_attr(not(target_arch = "x86"), link(name = $library, kind = "raw-dylib", modifiers = "+verbatim"))] + #[cfg_attr(target_arch = "x86", link(name = $library, kind = "raw-dylib", modifiers = "+verbatim", import_name_type = "undecorated"))] extern $abi { $(#[link_name=$link_name])? pub fn $($function)*;