class Library
pub class Library :: [Closeable]
Conforms to Closeable.
A shared library loaded while the program runs — a .so, .dylib or .dll — and the C
functions in it, found by their names.
let lib = try Library.open("libm.so.6");, then
lib.symbol<extern "C" fn(float) -> float>("cos") is the function cos as a value C's type
says, null where the library has no such symbol. The type is the program's word: the loader
knows a name, not a signature. A function of the library is called while the library is open;
Library.close gives it back.
Methods
pub static fn open(path: string): Library throws IoError
Loads the library at path; a name without a directory goes where the system's loader
looks.
Errors
Throws IoError with the path and the loader's words where it cannot load it.
pub fn symbol<F>(_name: string): ?F
Returns the C function name of the library as a value of F, a C function's type
(extern "C" fn(…) -> …); null where the library has no such symbol. The compiler reads
the address; this body never runs.
Panics
Where the library was closed.
pub fn close(): void
Gives the library back to the system; its functions are not called again. A second close does nothing.