Struct smithay::backend::egl::ffi::egl::LIB [−][src]
pub struct LIB { /* fields omitted */ }
Methods from Deref<Target = Library>
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. Providing a
null terminated symbol
may help to avoid an allocation.
Symbol is interpreted as-is; no mangling is done. This means that symbols like x::y
are
most likely invalid.
Safety
Users of this API must specify the correct type of the function or variable loaded. Using a
Symbol
with a wrong type is undefined.
Platform-specific behaviour
Implementation of thread local variables is extremely platform specific and uses of such variables that work on e.g. Linux may have unintended behaviour on other targets.
On POSIX implementations where the dlerror
function is not confirmed to be MT-safe (such
as FreeBSD), this function will unconditionally return an error when the underlying dlsym
call returns a null pointer. There are rare situations where dlsym
returns a genuine null
pointer without it being an error. If loading a null pointer is something you care about,
consider using the os::unix::Library::get_singlethreaded
call.
Examples
Given a loaded library:
let lib = unsafe { Library::new("/path/to/awesome.module").unwrap() };
Loading and using a function looks like this:
unsafe { let awesome_function: Symbol<unsafe extern fn(f64) -> f64> = lib.get(b"awesome_function\0").unwrap(); awesome_function(0.42); }
A static variable may also be loaded and inspected:
unsafe { let awesome_variable: Symbol<*mut f64> = lib.get(b"awesome_variable\0").unwrap(); **awesome_variable = 42.0; };
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for LIB
impl UnwindSafe for LIB
Blanket Implementations
Mutably borrows from an owned value. Read more
Convert Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read more
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more
pub fn vzip(self) -> V