Expand description
The dopen_rs crate supports loading dynamic libraries from memory and files,
supports no_std environments, and does not rely on the dynamic linker ldso
There is no support for debugging loaded dynamic libraries using gdb
§Examples
use dlopen_rs::ELFLibrary;
use std::path::Path;
let path = Path::new("./target/release/libexample.so");
let libc = ELFLibrary::sys_load("libc.so.6").unwrap();
let libgcc = ELFLibrary::sys_load("libgcc_s.so.1").unwrap();
let libexample = ELFLibrary::from_file(path)
.unwrap()
.relocate(&[libgcc, libc])
.unwrap();
let f = unsafe {
libexample
.get::<extern "C" fn(i32) -> i32>("c_fun_add_two")
.unwrap()
};
println!("{}", f(2));