dlib

Macro ffi_dispatch_static

source
macro_rules! ffi_dispatch_static {
    (feature=$feature: expr, $handle: expr, $name: ident) => { ... };
    ($handle:expr, $name: ident) => { ... };
}
Expand description

Macro for generically accessing a FFI static

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.
  • A value of the handle generated by the macro external_library! when the dlopen-controlling feature is enabled
  • The name of the static

The macro invocation evaluates to a &T reference to the static

§Example
let my_static = unsafe { ffi_dispatch!(feature="dlopen", LIBRARY_HANDLE, my_static) };