Added a macro for wrapping C STD lib functions.
This commit is contained in:
parent
3bc41bae4f
commit
ecb382c0c3
@ -1,3 +1,37 @@
|
|||||||
|
#[macro_export]
|
||||||
|
macro_rules! c_library
|
||||||
|
{
|
||||||
|
{
|
||||||
|
$(statics:
|
||||||
|
{
|
||||||
|
$($sname: ident: $stype: ty);+;
|
||||||
|
}
|
||||||
|
)?
|
||||||
|
|
||||||
|
$(functions:
|
||||||
|
{
|
||||||
|
$($fname: ident($($farg: ident: $fargt: ty),*) -> $fret:ty);+;
|
||||||
|
}
|
||||||
|
)?
|
||||||
|
|
||||||
|
$(varargs:
|
||||||
|
{
|
||||||
|
$($vname: ident($($vargs: ident: $vargst: ty),+) -> $vret:ty);+;
|
||||||
|
}
|
||||||
|
)?
|
||||||
|
} =>
|
||||||
|
{
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
$($(pub static $sname: $stype;)+)?
|
||||||
|
|
||||||
|
$($(pub fn $fname($($farg: $fargt),*) -> $fret;)+)?
|
||||||
|
|
||||||
|
$($(pub fn $vname($(vargs: $vargst),+ , ...) -> $vret;)+)?
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! external_library
|
macro_rules! external_library
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user