[−][src]Struct libloading::os::windows::Library
A platform-specific counterpart of the cross-platform Library.
Implementations
impl Library[src]
pub fn new<P: AsRef<OsStr>>(filename: P) -> Result<Library, Error>[src]
Find and load a module.
If the filename specifies a full path, the function only searches that path for the
module. Otherwise, if the filename specifies a relative path or a module name without a
path, the function uses a windows-specific search strategy to find the module; for more
information, see the Remarks on MSDN.
If the filename specifies a library filename without path and with extension omitted,
.dll extension is implicitly added. This behaviour may be suppressed by appending a
trailing . to the filename.
This is equivalent to Library::load_with_flags(filename, 0).
pub fn this() -> Result<Library, Error>[src]
Load the Library representing the original program executable.
Note that behaviour of Library loaded with this method is different from
Libraries loaded with os::unix::Library::this. For more information refer to MSDN.
Corresponds to GetModuleHandleExW(0, NULL, _).
pub fn load_with_flags<P: AsRef<OsStr>>(
filename: P,
flags: DWORD
) -> Result<Library, Error>[src]
filename: P,
flags: DWORD
) -> Result<Library, Error>
Find and load a module, additionally adjusting behaviour with flags.
See Library::new for documentation on handling of the filename argument. See the
flag table on MSDN for information on applicable values for the flags argument.
Corresponds to LoadLibraryExW(filename, reserved: NULL, flags).
pub unsafe fn get<T>(&self, symbol: &[u8]) -> Result<Symbol<T>, Error>[src]
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. A null
terminated symbol may avoid a string allocation in some cases.
Symbol is interpreted as-is; no mangling is done. This means that symbols like x::y are
most likely invalid.
Safety
This function does not validate the type T. It is up to the user of this function to
ensure that the loaded symbol is in fact a T. Using a value with a wrong type has no
definied behaviour.
pub unsafe fn get_ordinal<T>(&self, ordinal: WORD) -> Result<Symbol<T>, Error>[src]
Get a pointer to function or static variable by ordinal number.
Safety
Pointer to a value of arbitrary type is returned. Using a value with wrong type is undefined.
pub fn into_raw(self) -> HMODULE[src]
Convert the Library to a raw handle.
pub unsafe fn from_raw(handle: HMODULE) -> Library[src]
Convert a raw handle to a Library.
Safety
The handle shall be a result of a successful call of LoadLibraryW or a
handle previously returned by the Library::into_raw call.
pub fn close(self) -> Result<(), Error>[src]
Unload the library.
You only need to call this if you are interested in handling any errors that may arise when
library is unloaded. Otherwise this will be done when Library is dropped.
The underlying data structures may still get leaked if an error does occur.
Trait Implementations
impl Debug for Library[src]
impl Drop for Library[src]
impl Send for Library[src]
impl Sync for Library[src]
Auto Trait Implementations
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,