5
5
#[ cfg( all( windows_raw_dylib, target_arch = "x86" ) ) ]
6
6
#[ macro_export]
7
7
macro_rules! link {
8
+ ( $library: literal "cdecl" $( $link_name: literal) ? fn $( $function: tt) * ) => (
9
+ $crate:: link!( $library "C" $( $link_name) ? fn $( $function) * ) ;
10
+ ) ;
8
11
( $library: literal $abi: literal $( $link_name: literal) ? fn $( $function: tt) * ) => (
9
12
#[ link( name = $library, kind = "raw-dylib" , modifiers = "+verbatim" , import_name_type = "undecorated" ) ]
10
13
extern $abi {
@@ -18,21 +21,11 @@ macro_rules! link {
18
21
#[ cfg( all( windows_raw_dylib, not( target_arch = "x86" ) ) ) ]
19
22
#[ macro_export]
20
23
macro_rules! link {
24
+ ( $library: literal "cdecl" $( $link_name: literal) ? fn $( $function: tt) * ) => (
25
+ $crate:: link!( $library "C" $( $link_name) ? fn $( $function) * ) ;
26
+ ) ;
21
27
( $library: literal $abi: literal $( $link_name: literal) ? fn $( $function: tt) * ) => (
22
28
#[ 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" ) ]
36
29
extern $abi {
37
30
$( #[ link_name=$link_name] ) ?
38
31
pub fn $( $function) * ;
@@ -41,12 +34,15 @@ macro_rules! link {
41
34
}
42
35
43
36
/// Defines an external function to import.
44
- #[ cfg( all( windows, not( windows_raw_dylib) , not ( target_arch = "x86" ) ) ) ]
37
+ #[ cfg( all( windows, not( windows_raw_dylib) ) ) ]
45
38
#[ macro_export]
46
39
macro_rules! link {
40
+ ( $library: literal "cdecl" $( $link_name: literal) ? fn $( $function: tt) * ) => (
41
+ $crate:: link!( $library "C" $( $link_name) ? fn $( $function) * ) ;
42
+ ) ;
47
43
( $library: literal $abi: literal $( $link_name: literal) ? fn $( $function: tt) * ) => (
48
44
#[ link( name = "windows.0.53.0" ) ]
49
- extern "C" {
45
+ extern $abi {
50
46
$( #[ link_name=$link_name] ) ?
51
47
pub fn $( $function) * ;
52
48
}
@@ -57,8 +53,11 @@ macro_rules! link {
57
53
#[ cfg( all( not( windows) , not( windows_raw_dylib) ) ) ]
58
54
#[ macro_export]
59
55
macro_rules! link {
56
+ ( $library: literal "cdecl" $( $link_name: literal) ? fn $( $function: tt) * ) => (
57
+ $crate:: link!( $library "C" $( $link_name) ? fn $( $function) * ) ;
58
+ ) ;
60
59
( $library: literal $abi: literal $( $link_name: literal) ? fn $( $function: tt) * ) => (
61
- extern "C" {
60
+ extern $abi {
62
61
pub fn $( $function) * ;
63
62
}
64
63
)
0 commit comments