55#[ cfg( all( windows_raw_dylib, target_arch = "x86" ) ) ]
66#[ macro_export]
77macro_rules! link {
8+ // Avoid future-compat lint if bindings are still using the old "cdecl" form of the bindings.
9+ ( $library: literal "cdecl" $( $link_name: literal) ? fn $( $function: tt) * ) => (
10+ $crate:: link!( $library "C" $( $link_name) ? fn $( $function) * ) ;
11+ ) ;
812 ( $library: literal $abi: literal $( $link_name: literal) ? fn $( $function: tt) * ) => (
913 #[ link( name = $library, kind = "raw-dylib" , modifiers = "+verbatim" , import_name_type = "undecorated" ) ]
1014 extern $abi {
@@ -18,21 +22,12 @@ macro_rules! link {
1822#[ cfg( all( windows_raw_dylib, not( target_arch = "x86" ) ) ) ]
1923#[ macro_export]
2024macro_rules! link {
25+ // Avoid future-compat lint if bindings are still using the old "cdecl" form of the bindings.
26+ ( $library: literal "cdecl" $( $link_name: literal) ? fn $( $function: tt) * ) => (
27+ $crate:: link!( $library "C" $( $link_name) ? fn $( $function) * ) ;
28+ ) ;
2129 ( $library: literal $abi: literal $( $link_name: literal) ? fn $( $function: tt) * ) => (
2230 #[ link( name = $library, kind = "raw-dylib" , modifiers = "+verbatim" ) ]
23- extern "C" {
24- $( #[ link_name=$link_name] ) ?
25- pub fn $( $function) * ;
26- }
27- )
28- }
29-
30- /// Defines an external function to import.
31- #[ cfg( all( windows, not( windows_raw_dylib) , target_arch = "x86" ) ) ]
32- #[ macro_export]
33- macro_rules! link {
34- ( $library: literal $abi: literal $( $link_name: literal) ? fn $( $function: tt) * ) => (
35- #[ link( name = "windows.0.53.0" ) ]
3631 extern $abi {
3732 $( #[ link_name=$link_name] ) ?
3833 pub fn $( $function) * ;
@@ -41,12 +36,16 @@ macro_rules! link {
4136}
4237
4338/// Defines an external function to import.
44- #[ cfg( all( windows, not( windows_raw_dylib) , not ( target_arch = "x86" ) ) ) ]
39+ #[ cfg( all( windows, not( windows_raw_dylib) ) ) ]
4540#[ macro_export]
4641macro_rules! link {
42+ // Avoid future-compat lint if bindings are still using the old "cdecl" form of the bindings.
43+ ( $library: literal "cdecl" $( $link_name: literal) ? fn $( $function: tt) * ) => (
44+ $crate:: link!( $library "C" $( $link_name) ? fn $( $function) * ) ;
45+ ) ;
4746 ( $library: literal $abi: literal $( $link_name: literal) ? fn $( $function: tt) * ) => (
4847 #[ link( name = "windows.0.53.0" ) ]
49- extern "C" {
48+ extern $abi {
5049 $( #[ link_name=$link_name] ) ?
5150 pub fn $( $function) * ;
5251 }
@@ -57,8 +56,12 @@ macro_rules! link {
5756#[ cfg( all( not( windows) , not( windows_raw_dylib) ) ) ]
5857#[ macro_export]
5958macro_rules! link {
59+ // Avoid future-compat lint if bindings are still using the old "cdecl" form of the bindings.
60+ ( $library: literal "cdecl" $( $link_name: literal) ? fn $( $function: tt) * ) => (
61+ $crate:: link!( $library "C" $( $link_name) ? fn $( $function) * ) ;
62+ ) ;
6063 ( $library: literal $abi: literal $( $link_name: literal) ? fn $( $function: tt) * ) => (
61- extern "C" {
64+ extern $abi {
6265 pub fn $( $function) * ;
6366 }
6467 )
0 commit comments