Crate shared_lib

Source
Expand description

A small wrapper around the libloading crate that aims to improve the system path and error handling.

§Usage

In your code, run the following:

use shared_lib::*;
use std::path::PathBuf;
 
let lib_path = LibPath::new(PathBuf::from("path/to/dir"), "library_name_no_ext".into());
unsafe {
   let lib = SharedLib::new(lib_path).unwrap();
   let func = lib.get_fn::<fn(usize, usize) -> usize>("foo").unwrap();
   let result = func.run(1, 2);
}

Structs§

LibPath
Structure representing a shared library path.
SharedLib
Structure representing a shared library.
SharedLibFn
Structure representing a shared library function.

Enums§

SharedLibError
Enum representing the possible errors that can occur when working with shared libraries.