lib.rs |
Proc macro equivalent to the following rust macro:
```
macro_rules! link {
($library:literal $abi:literal $($link_name:literal)? $(#[$($doc:tt)*])* fn $name:ident($($arg:ident: $argty:ty),*)->$ret:ty) => (
extern $abi {
#[link(name = $library)]
$(#[link_name=$link_name])?
pub fn $name($($arg: $argty),*) -> $ret;
}
)
}
```
with the additional feature of removing ".dll" from the $library literal.
The macro is derived from the equivalent macro in the real windows-targets crate,
with the difference that it uses #[link] with the name of the library rather than
a single "windows.$version" library, so as to avoid having to vendor all the fake
"windows.$version" import libraries. We can do that because we also require MSVC
to build, so we do have the real import libraries available.
As the library name is there in the original for raw-dylib support, it contains
a suffixed name, but plain #[link] expects a non-suffixed name, which is why we
remove the suffix (and why this had to be a proc-macro).
Once raw-dylib is more widely available and tested, we'll be able to use the
raw-dylib variants directly.
|
2882 |