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