Attribute Macro dylink_macro::dylink

source ·
#[dylink]
Expand description

Macro for generating shared symbol thunks procedurally.

May currently be used in 2 patterns:

  • foreign modules
  • foreign functions

Using an unwind friendly abi should be used whenever possible to prevent undefined behavior from occuring.

Examples

 use dylink::*;
 static FOOBAR: sync::LibLock = sync::LibLock::new(&["foobar.dll"]);

 // foreign module pattern
 #[dylink(library=FOOBAR)]
 extern "system-unwind" {
     fn foo();
 }

 // foreign function pattern
 #[dylink(library=FOOBAR)]
 extern "system-unwind" fn bar();