1 | #![doc = include_str!("../readme.md" )] |
2 | #![no_std ] |
3 | |
4 | /// Defines an external function to import. |
5 | #[cfg (all(windows, target_arch = "x86" ))] |
6 | #[macro_export ] |
7 | macro_rules! link { |
8 | ($library:literal $abi:literal $($link_name:literal)? fn $($function:tt)*) => ( |
9 | #[link(name = $library, kind = "raw-dylib" , modifiers = "+verbatim" , import_name_type = "undecorated" )] |
10 | extern $abi { |
11 | $(#[link_name=$link_name])? |
12 | pub fn $($function)*; |
13 | } |
14 | ) |
15 | } |
16 | |
17 | /// Defines an external function to import. |
18 | #[cfg (all(windows, not(target_arch = "x86" )))] |
19 | #[macro_export ] |
20 | macro_rules! link { |
21 | ($library:literal $abi:literal $($link_name:literal)? fn $($function:tt)*) => ( |
22 | #[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 (not(windows))] |
32 | #[macro_export ] |
33 | macro_rules! link { |
34 | ($library:literal $abi:literal $($link_name:literal)? fn $($function:tt)*) => ( |
35 | extern $abi { |
36 | pub fn $($function)*; |
37 | } |
38 | ) |
39 | } |
40 | |