32 lines
616 B
Rust
32 lines
616 B
Rust
|
#[macro_export]
|
||
|
macro_rules! external_library
|
||
|
{
|
||
|
{
|
||
|
$name: ident : $link: ident
|
||
|
{
|
||
|
$(statics:
|
||
|
$($sname: ident: $stype: ty),+;
|
||
|
)|*
|
||
|
|
||
|
$(functions:
|
||
|
$($fname: ident($($farg: ty),*) -> $fret:ty),+;
|
||
|
)|*
|
||
|
|
||
|
$(varargs:
|
||
|
$($vname: ident($($vargs: ty),+) -> $vret: ty),+;
|
||
|
)|*
|
||
|
}
|
||
|
} =>
|
||
|
{
|
||
|
#[link(name=$link)]
|
||
|
extern "C"
|
||
|
{
|
||
|
$($(pub static $sname: $stype;)+)*
|
||
|
|
||
|
$($(pub fn $fname($(_: $farg),*) -> $fret;)+)*
|
||
|
|
||
|
$($(pub fn $vname($(_: $vargs),+ , ...) -> $vret;)+)*
|
||
|
}
|
||
|
}
|
||
|
}
|