[][src]Struct beryllium::CDyLib

#[repr(transparent)]
pub struct CDyLib<'sdl> { /* fields omitted */ }

Handle to a C ABI dynamic library that has been loaded.

You can make your own libs that will work with this using the cdylib crate type (here is a short tutorial).

Do not attempt to mix this with the dylib crate type. That's a crate type you should not use, it's basically for rustc internal usage only.

Methods

impl<'sdl> CDyLib<'sdl>[src]

pub unsafe fn find_function(&self, name: &str) -> Option<NonNull<c_void>>[src]

Attempts to look up a function by name, getting its pointer.

Once this function returns, you will have to transmute the optional NonNull value you get into an optional fn value of some sort.

You probably want to transmute it into Option<unsafe extern "C" fn(INPUTS) -> OUTPUTS>, but it's possible that you might need to use some other ABI for example. This whole thing is obviously not at all safe. You absolutely must get the fn type correct when doing this transmute.

Safety

  • The returned value does not have a lifetime linking it back to this shared library. Making sure that the function pointer is not used after this library unloads is up to you.

Trait Implementations

impl<'sdl> Drop for CDyLib<'sdl>[src]

impl<'sdl> Debug for CDyLib<'sdl>[src]

Auto Trait Implementations

impl<'sdl> !Send for CDyLib<'sdl>

impl<'sdl> Unpin for CDyLib<'sdl>

impl<'sdl> !Sync for CDyLib<'sdl>

impl<'sdl> UnwindSafe for CDyLib<'sdl>

impl<'sdl> RefUnwindSafe for CDyLib<'sdl>

Blanket Implementations

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.

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

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]