-
Notifications
You must be signed in to change notification settings - Fork 511
/
lib.rs
55 lines (50 loc) · 1.56 KB
/
lib.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*!
Learn more about Rust for Windows here: <https://github.com/microsoft/windows-rs>
*/
#![no_std]
#[cfg(all(windows_raw_dylib, target_arch = "x86"))]
#[macro_export]
macro_rules! link {
($library:literal $abi:literal $($link_name:literal)? $(#[$doc:meta])? fn $($function:tt)*) => (
#[link(name = $library, kind = "raw-dylib", modifiers = "+verbatim", import_name_type = "undecorated")]
extern $abi {
$(#[$doc])?
$(#[link_name=$link_name])?
pub fn $($function)*;
}
)
}
#[cfg(all(windows_raw_dylib, not(target_arch = "x86")))]
#[macro_export]
macro_rules! link {
($library:literal $abi:literal $($link_name:literal)? $(#[$doc:meta])? fn $($function:tt)*) => (
#[link(name = $library, kind = "raw-dylib", modifiers = "+verbatim")]
extern "C" {
$(#[$doc])?
$(#[link_name=$link_name])?
pub fn $($function)*;
}
)
}
#[cfg(all(windows, not(windows_raw_dylib)))]
#[macro_export]
macro_rules! link {
($library:literal $abi:literal $($link_name:literal)? $(#[$doc:meta])? fn $($function:tt)*) => (
#[link(name = "windows.0.52.0")]
extern $abi {
$(#[$doc])?
$(#[link_name=$link_name])?
pub fn $($function)*;
}
)
}
#[cfg(all(not(windows), not(windows_raw_dylib)))]
#[macro_export]
macro_rules! link {
($library:literal $abi:literal $($link_name:literal)? $(#[$doc:meta])? fn $($function:tt)*) => (
extern $abi {
$(#[$doc])?
pub fn $($function)*;
}
)
}