[−][src]Struct libloading::os::unix::Library
A platform-specific equivalent of the cross-platform Library
.
Methods
impl Library
[src]
pub fn new<P: AsRef<OsStr>>(filename: P) -> Result<Library>
[src]
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, RTLD_NOW)
.
pub fn this() -> Library
[src]
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, RTLD_NOW)
.
pub fn open<P>(filename: Option<P>, flags: c_int) -> Result<Library> where
P: AsRef<OsStr>,
[src]
P: AsRef<OsStr>,
Find and load a shared library (module).
Locations where library is searched for is platform specific and can’t be adjusted portably.
If the filename
is None, null pointer is passed to dlopen
.
Corresponds to dlopen(filename, flags)
.
pub unsafe fn get<T>(&self, symbol: &[u8]) -> Result<Symbol<T>>
[src]
Get a pointer to function or static variable by symbol name.
The symbol
may not contain any null bytes, with an exception of last byte. A null
terminated symbol
may avoid a string allocation in some cases.
Symbol is interpreted as-is; no mangling is done. This means that symbols like x::y
are
most likely invalid.
Unsafety
Pointer to a value of arbitrary type is returned. Using a value with wrong type is undefined.
Platform-specific behaviour
OS X uses some sort of lazy initialization scheme, which makes loading TLS variables impossible. Using a TLS variable loaded this way on OS X is undefined behaviour.
pub fn into_raw(self) -> *mut c_void
[src]
Convert the Library
to a raw handle.
The handle returned by this function shall be usable with APIs which accept handles
as returned by dlopen
.
pub unsafe fn from_raw(handle: *mut c_void) -> Library
[src]
Convert a raw handle returned by dlopen
-family of calls to a Library
.
Unsafety
The pointer shall be a result of a successful call of the dlopen
-family of functions or a
pointer previously returned by Library::into_raw
call. It must be valid to call dlclose
with this pointer as an argument.
Trait Implementations
impl Drop for Library
[src]
impl Sync for Library
[src]
impl From<Library> for Library
[src]
impl From<Library> for Library
[src]
impl Send for Library
[src]
impl Debug for Library
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,