I am using libloading to loading dll, it requires me to confirm the parameter what function need, like this:
let lib = libloading::Library::new("libstd.dylib").unwrap();
let func: Symbol<fn(&str)> = lib.get(b"println").unwrap();
// ^ it requires to confirm the parameter what function need
func("Hello World");
But I want to make a function to call functions from libstd.dylib, Both parameters and types are indeterminate
fn call_from_libstd() {} // I don't know how to implement this function
call_from_libstd("println", "Hello World");
let c = call_from_libstd("add", 10, 20);
println("{}", c);
The functions form dll is like
#[no_mangle]
pub fn println(str: &str) {
println!("{}", str);
}
#[no_mangle]
pub fn add (a: usize,b:usize) -> usize {
return a + b;
}