pub struct RelocatedDylib {
pub inner: Arc<Dylib>,
}Expand description
A dynamic library that has been relocated
Fields§
§inner: Arc<Dylib>Implementations§
Source§impl RelocatedDylib
impl RelocatedDylib
Sourcepub fn dep_libs(&self) -> Option<&[RelocatedDylib]>
pub fn dep_libs(&self) -> Option<&[RelocatedDylib]>
Get dependent libraries.
§Examples
if let Some(dependencies) = library.dep_libs() {
for lib in dependencies {
println!("Dependency: {:?}", lib);
}
} else {
println!("No dependencies found.");
}Sourcepub unsafe fn get<'lib, T>(
&'lib self,
name: &str,
) -> Result<Symbol<'lib, T>, Error>
pub unsafe fn get<'lib, T>( &'lib self, name: &str, ) -> Result<Symbol<'lib, T>, Error>
Get a pointer to a function or static variable by symbol name.
The 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.
§Examples
unsafe {
let awesome_function: Symbol<unsafe extern fn(f64) -> f64> =
lib.get("awesome_function").unwrap();
awesome_function(0.42);
}A static variable may also be loaded and inspected:
unsafe {
let awesome_variable: Symbol<*mut f64> = lib.get("awesome_variable").unwrap();
**awesome_variable = 42.0;
};Trait Implementations§
Source§impl Clone for RelocatedDylib
impl Clone for RelocatedDylib
Source§fn clone(&self) -> RelocatedDylib
fn clone(&self) -> RelocatedDylib
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RelocatedDylib
impl Debug for RelocatedDylib
impl Send for RelocatedDylib
Auto Trait Implementations§
impl Freeze for RelocatedDylib
impl !RefUnwindSafe for RelocatedDylib
impl !Sync for RelocatedDylib
impl Unpin for RelocatedDylib
impl !UnwindSafe for RelocatedDylib
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more