1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// dl_api
//
// Copyright (c) 2018 Jeron A. Lau
// Copyright (c) 2017 Szymon Wieloch
// Distributed under the MIT LICENSE (See accompanying file LICENSE.txt)
//! `dl_api` is a library for dynamically loading API's from .dll/.so/.dylib
//! files. It's based off of `rust-dlopen`. A lot of simplifications have
//! been made.
//!
//! It's the easiest, simplest and safest way to load dynamic (shared object) libraries!
//!
//! # Getting Started: Example
//! The code inside of the curly braces for `link!()` matches exactly with code inside of the curly
//! braces for `extern "C"`. This makes it easy for you to turn your `extern "C"`s into `link!()`s.
//! ```
//! // Shared object: either "libmylibrary.so.1", "mylibrary-1.dll" or "libMyLibrary.dylib"
//! dl_api::link!(MyApi, "libmylibrary.so.1", {
//! fn cFunction(param_name: ParamType) -> ReturnType;
//! });
//!
//! fn main() {
//! let api = MyApi::new().unwrap(); // unwrap the `Result`.
//!
//! let rtn: ReturnType = unsafe {
//! (api.cFunction)(0);
//! };
//! }
//! ```
//!
extern crate lazy_static;
extern crate libc;
extern crate winapi;
pub use crateError;
pub use crateLibrary; // Use in dl_api only.