libloader
libloader is a easy-to-use DLL loader for rust that based on libloading
It is very easy to dynamically call a function from dynamic link library (DLL files for Windows, so files for Unix/Linux dylib for macOS )
Use this function to get the function from DLL
get_libfn!;
For example, We have these functions from libstd.dylib
// lib.rs (compiled into libstd.dylib)
We can call it with:
// main.rs
fn main() {
get_libfn!("libstd.dylib", "println", my_println, (), str: &str);
my_println("Hello World");
get_libfn!("libstd.dylib", "add", my_add, usize, a: usize, b: usize);
println!("10 + 20 = {}", my_add(10, 20));
get_libfn!("libstd.dylib", "print_hello", my_print_hello, ());
my_print_hello();
}