Skip to main content

Module loader

Module loader 

Source
Expand description

Generic dlopen loading.

§No type erasure here

T is the host’s own #[repr(C)] entry struct (for bmux, that is BmuxPluginV1). load() returns a *const T — a thin pointer, not a dyn Trait — so there is no “convert a fat pointer between two different vtables” UB.

This crate neither knows nor needs to know which fields T has; it only reads the symbol address and casts it to *const T. Reading those fields safely is the host contract crate’s job.

§What the caller has to guarantee

  1. T and the struct the plugin actually exports have the same layout (backed by the host’s abi_version field);
  2. every read of a field of T is wrapped in crate::panic::guard.

Structs§

LoadedPlugin
A loaded plugin.

Functions§

find_library
Finds a cdylib in a directory by walking the candidate list, returning the first one that exists.
find_library_for_target
find_library, for a specific target triple.
lib_ext_for_target
The cdylib extension implied by a target triple.
library_candidates
The cdylib file name candidates for this build’s target, in priority order.
library_candidates_for_target
The cdylib file name candidates for target, in priority order.
open⚠
Opens a cdylib and calls its entry function.