Skip to content

tomtar00/shared_lib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Rust library that makes it easier to load shared libraries across platforms

Resources

License

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages