Skip to content

Commit

Permalink
Updated readme and marketing. Version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
szymonwieloch committed Aug 16, 2019
1 parent 9fc15f1 commit 3d6c40b
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 3 deletions.
5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
[package]
name = "dlopen"
version = "0.1.7"
version = "0.1.8"
readme = "README.md"
authors = ["Szymon Wieloch <[email protected]>"]
description = "Library for opening and operating on dynamic link libraries (also known as shared objects or shared libraries)."
description = "Library for opening and operating on dynamic link libraries (also known as shared objects or shared libraries). This is a modern and more flexible alternative to the already existing libraries like libloading or sharedlib"
keywords = [
#common functions
"dlopen", "dll", "so", "dylib", "shared"]
Expand Down
30 changes: 29 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# rust-dlopen

[![Travis CI][tcii]][tci] [![Appveyor CI][acii]][aci] [![Crates CI][ccii]][cci] [![Codedov CI][vcii]][vci]
[![Travis CI][tcii]][tci] [![Appveyor CI][acii]][aci] [![Crates CI][ccii]][cci] [![Codedov CI][vcii]][vci] [![Docs][dcii]][dci]

[tcii]: https://travis-ci.org/szymonwieloch/rust-dlopen.svg?branch=master
[tci]: https://travis-ci.org/szymonwieloch/rust-dlopen
Expand All @@ -10,13 +10,40 @@
[cci]: https://crates.io/crates/dlopen
[vcii]: https://codecov.io/api/gh/szymonwieloch/rust-dlopen/branch/master/graph/badge.svg
[vci]: https://codecov.io/gh/szymonwieloch/rust-dlopen
[dcii]: https://docs.rs/dlopen/badge.svg
[dci]: https://docs.rs/dlopen

# Overview

This library is my effort to make use of dynamic link libraries in Rust simple.
Previously existing solutions were either unsafe, provided huge overhead of required writing too much code to achieve simple things.
I hope that this library will help you to quickly get what you need and avoid errors.

# Quick example

```rust
extern crate dlopen;
#[macro_use]
extern crate dlopen_derive;
use dlopen::wrapper::{Container, WrapperApi};

#[derive(WrapperApi)]
struct Api<'a> {
example_rust_fun: fn(arg: i32) -> u32,
example_c_fun: unsafe extern "C" fn(),
example_reference: &'a mut i32,
}

fn main(){
let mut cont: Container<Api> =
unsafe { Container::load("libexample.so") }.expect("Could not open library or load symbols");
cont.example_rust_fun(5);
unsafe{cont.example_c_fun()};
*cont.example_reference_mut() = 5;
}
```


# Features

## Main features
Expand Down Expand Up @@ -45,6 +72,7 @@ I hope that this library will help you to quickly get what you need and avoid er
| Low-level, unsafe API | Yes | Yes | Yes |
| Object-oriented friendly | Yes | **No** | Yes |
| Load from the program itself | Yes | **No** | **No** |
| Obtaining address information (dladdr) | Yes | **Unix only** | **no**|

## Safety

Expand Down
25 changes: 25 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,30 @@ This library is an effort to make use of dynamic link libraries in Rust simple.
Previously existing solutions were either unsafe, provided huge overhead of required writing too much code to achieve simple things.
I hope that this library will help you to quickly get what you need and avoid errors.
# Quick example
```no_run
extern crate dlopen;
#[macro_use]
extern crate dlopen_derive;
use dlopen::wrapper::{Container, WrapperApi};
#[derive(WrapperApi)]
struct Api<'a> {
example_rust_fun: fn(arg: i32) -> u32,
example_c_fun: unsafe extern "C" fn(),
example_reference: &'a mut i32,
}
fn main(){
let mut cont: Container<Api> =
unsafe { Container::load("libexample.so") }.expect("Could not open library or load symbols");
cont.example_rust_fun(5);
unsafe{cont.example_c_fun()};
*cont.example_reference_mut() = 5;
}
```
# Features
## Main features
Expand Down Expand Up @@ -36,6 +60,7 @@ I hope that this library will help you to quickly get what you need and avoid er
| Low-level, unsafe API | Yes | Yes | Yes |
| Object-oriented friendly | Yes | **No** | Yes |
| Load from the program itself | Yes | **No** | **No** |
| Obtaining address information (dladdr) | Yes | **Unix only** | **no**|
## Safety
Expand Down

0 comments on commit 3d6c40b

Please sign in to comment.