#dlopen #dll #so #load-library #dlsym

minidl

Extremely lean cross platform library for loading symbols

7 releases

new 0.1.6 Dec 8, 2023
0.1.5 Dec 9, 2022
0.1.4 Feb 7, 2022
0.1.3 Jan 21, 2022
0.1.0 Jan 14, 2020

#98 in Operating systems

Download history 1669/week @ 2023-08-19 935/week @ 2023-08-26 1170/week @ 2023-09-02 1793/week @ 2023-09-09 1190/week @ 2023-09-16 998/week @ 2023-09-23 888/week @ 2023-09-30 851/week @ 2023-10-07 3083/week @ 2023-10-14 1008/week @ 2023-10-21 961/week @ 2023-10-28 935/week @ 2023-11-04 621/week @ 2023-11-11 547/week @ 2023-11-18 724/week @ 2023-11-25 477/week @ 2023-12-02

2,459 downloads per month
Used in 8 crates (5 directly)

MIT/Apache

27KB
131 lines

minidl

Crates.io Docs unsafe: yes rust: stable License
GitHub Build Status Open issues dependency status

Extremely lean cross platform library for loading symbols.

  • No dependencies (minimal build times)
  • No macros (minimal build times)
  • No safety (ABI mismatches would be unsound anyways)

Quick Start

use minidl::*;
use std::os::raw::*;

struct Example {
    OutputDebugStringA: unsafe extern "system" fn (_: *const c_char),
    Invalid_Optional:   Option<unsafe extern "system" fn (_: *const c_char)>,
}

impl Example {
    pub fn new() -> Result<Self> {
        let lib = Library::load("kernel32.dll")?;
        unsafe{Ok(Self{
            OutputDebugStringA: lib.sym("OutputDebugStringA\0")?,
            Invalid_Optional:   lib.sym_opt("Invalid_Optional\0"),
        })}
    }
}

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

No runtime deps