macro_rules! external_library {
(feature=$feature: expr, $structname: ident, $link: expr,
$(statics: $($sname: ident: $stype: ty),+,)|*
$(functions: $(fn $fname: ident($($farg: ty),*) -> $fret:ty),+,)|*
$(varargs: $(fn $vname: ident($($vargs: ty),+) -> $vret: ty),+,)|*
) => { ... };
($structname: ident, $link: expr,
$(statics: $($sname: ident: $stype: ty),+,)|*
$(functions: $(fn $fname: ident($($farg: ty),*) -> $fret:ty),+,)|*
$(varargs: $(fn $vname: ident($($vargs: ty),+) -> $vret: ty),+,)|*
) => { ... };
}
Expand description
Main macro of this library, used to generate the the FFI bindings.
The expected arguments are, in order:
- (Optional) The name of the cargo feature conditioning the usage of dlopen, in the form
feature="feature-name"
. If ommited, the feature"dlopen"
will be used. - The name of the struct that will be generated when the dlopen-controlling feature is enabled
- The link name of the target library
- The desctription of the statics, functions, and vararg functions that should be linked
See crate-level documentation for a detailed example of use.