chore: reorg
This commit is contained in:
14
__ffi/live-reload-rust/greet-rs-3/src/main.rs
Normal file
14
__ffi/live-reload-rust/greet-rs-3/src/main.rs
Normal file
@@ -0,0 +1,14 @@
|
||||
use cstr::cstr;
|
||||
use std::{error::Error, os::raw::c_char};
|
||||
|
||||
use libloading::{Library, Symbol};
|
||||
|
||||
fn main() -> Result<(), Box<dyn Error>> {
|
||||
let lib = Library::new("../libgreet.so")?;
|
||||
unsafe {
|
||||
let greet: Symbol<unsafe extern "C" fn(name: *const c_char)> = lib.get(b"greet")?;
|
||||
greet(cstr!("rust macros").as_ptr());
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user