Struct dlopen_rs::ELFLibrary
source · pub struct ELFLibrary { /* private fields */ }Implementations§
source§impl ELFLibrary
impl ELFLibrary
source§impl ELFLibrary
impl ELFLibrary
sourcepub fn relocate(
self,
internal_libs: &[RelocatedLibrary],
) -> Result<RelocatedLibrary>
pub fn relocate( self, internal_libs: &[RelocatedLibrary], ) -> Result<RelocatedLibrary>
use internal dependent libraries to relocate the current library
§Examples
let libc = ELFLibrary::load_self("libc").unwrap();
let libgcc = ELFLibrary::load_self("libgcc").unwrap();
let lib = ELFLibrary::from_file("/path/to/awesome.module")
.unwrap()
.relocate(&[libgcc, libc])
.unwrap();sourcepub fn relocate_with(
self,
internal_libs: &[RelocatedLibrary],
external_libs: Option<Vec<Box<dyn ExternLibrary + 'static>>>,
) -> Result<RelocatedLibrary>
pub fn relocate_with( self, internal_libs: &[RelocatedLibrary], external_libs: Option<Vec<Box<dyn ExternLibrary + 'static>>>, ) -> Result<RelocatedLibrary>
use internal and external dependency libraries to relocate the current library
source§impl ELFLibrary
impl ELFLibrary
sourcepub fn from_file<P: AsRef<OsStr>>(path: P) -> Result<ELFLibrary>
pub fn from_file<P: AsRef<OsStr>>(path: P) -> Result<ELFLibrary>
Find and load a elf dynamic library from path.
The filename argument may be either:
- A library filename;
- The absolute path to the library;
- A relative (to the current working directory) path to the library.
§Examples
let lib = ELFLibrary::from_file("/path/to/awesome.module")
.unwrap();sourcepub fn from_binary(bytes: &[u8]) -> Result<ELFLibrary>
pub fn from_binary(bytes: &[u8]) -> Result<ELFLibrary>
load a elf dynamic library from bytes
§Examples
let path = Path::new("/path/to/awesome.module");
let bytes = std::fs::read(path).unwrap();
let lib = ELFLibrary::from_binary(&bytes).unwarp();pub fn needed_libs(&self) -> &Vec<&str>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ELFLibrary
impl RefUnwindSafe for ELFLibrary
impl !Send for ELFLibrary
impl !Sync for ELFLibrary
impl Unpin for ELFLibrary
impl UnwindSafe for ELFLibrary
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