Struct libloading::os::unix::Library [] [src]

pub struct Library {
    // some fields omitted
}

A platform-specific equivalent of the cross-platform Library.

Methods

impl Library

fn new<P: AsRef<OsStr>>(filename: P) -> Result<Library>

Find and load a shared library (module).

Locations where library is searched for is platform specific and can’t be adjusted portably.

Corresponds to dlopen(filename).

fn this() -> Library

Load the dynamic libraries linked into main program.

This allows retrieving symbols from any dynamic library linked into the program, without specifying the exact library.

Corresponds to dlopen(NULL).

unsafe fn get<T>(&self, symbol: &[u8]) -> Result<Symbol<T>>

Get a symbol by name.

Mangling or symbol rustification is not done: trying to get something like x::y will not work.

You may append a null byte at the end of the byte string to avoid string allocation in some cases. E.g. for symbol sin you may write b"sin\0" instead of b"sin".

Unsafety

Symbol of arbitrary requested type is returned. Using a symbol with wrong type is not memory safe.

Trait Implementations

impl Drop for Library

fn drop(&mut self)

impl Debug for Library

fn fmt(&self, f: &mut Formatter) -> Result