bare::ffi::library
On this page
shared libraries loaded at run time: dlopen on
Unix, LoadLibraryW on Windows. A Library is never unloaded
implicitly; close is the only way, and it is unsafe because
every function pointer taken from it dangles afterwards.
Structs
LoadErrorSource
pub struct LoadErrorThe path given to
open.The system's reason (
dlerror,FormatMessageW).
SymbolErrorSource
pub struct SymbolErrorA library has no symbol of that name (Library::symbol).
The symbol asked for.
The system's reason (
dlerror,FormatMessageW).
LibrarySource
pub struct LibraryA loaded shared library, or the program itself (Library::this).
Load the shared library at
path(a bare name searches the system's library path). Throws with the system's reason.The program itself: its own symbols and, on Unix, those of every library it was linked with (
strlen). On Windows only what the executable exports.
Sourcepub fn raw_symbol(§self, name: str) throws (SymbolError) -> CPtr<c_void> The address of symbol
name, never null.
Sourcepub unsafe fn symbol<F>(§self, name: str) throws (SymbolError) -> F Symbol
nameasF, a C function pointer type (extern "C" fn(f64) -> f64).Safety:
Fmust be the symbol's real signature.Unload the library;
this()stays loaded.Safety: no pointer taken from it (
symbol, data it returned) may be used afterwards.