Expand description

minidl

Crates.io Docs unsafe: yes rust: stable License
GitHub Build Status: Travis Build Status: AppVeyor 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)
  • No unloading (would be unsound if the library spawned threads 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.

Structs

A loaded library handle.

Type Definitions

The error type of this library, std::io::Error

The result type of this library, std::io::Result