shared_lib 0.1.1

Wrapper around the libloading crate that aims to improve the system path and error handling.
Documentation
  • Coverage
  • 37.93%
    11 out of 29 items documented4 out of 18 items with examples
  • Size
  • Source code size: 15.02 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.36 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 14s Average build duration of successful builds.
  • all releases: 14s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • tomtar00/shared_lib
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • tomtar00

shared_lib

Wrapper around libloading crate that is a binding around platform's dynamic library loading primitives with greatly improved memory safety. shared_lib aims to improve the system path handling by using a custom structure representing platform independent path. The library also returns custom enum variants to better distinguish different kinds of errors.

Instalation

cargo add shared_lib

or add shared_lib to your Cargo.toml file.

Usage

use shared_lib::*;
use std::path::PathBuf;

fn main() {
    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);
       println!("Result = {}", result);
    }
}

Documentation

This library is available under the MIT License