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(())
}
