I created a dynamic lib from rust. I woul like to import it into another app. Sp I use libloading
I do
fn call_dynamic() -> Result<u32, Box<dyn std::error::Error>> {
unsafe {
let lib = libloading::Library::new("/path/to/liblibrary.so")?;
let func: libloading::Symbol<unsafe extern fn()> = lib.get(b"my_func")?;
Ok(func())
}
}
But the dynamic lib is async (it use tokio). My another app use tokio:
#[tokio::main]
async fn main() {
// load dyn lib
}
my_func:
#[no_mangle]
pub async fn my_func() {
//do async stuff
// I use external crate which depends on tokio anc his runtime
}
But I cannot see the log from the lib.
I think I have to do an await on loading the lib.
But how to do this ?
Thanks