[][src]Struct libloading::os::windows::Library

pub struct Library(_);
This is supported on Windows only.

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]

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.

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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.