dyn-loader 0.4.0

Dynamic library loader with dyn-fat-pointer-bridge for loading trait objects from .so/.dylib plugins. IMPORTANT: strictly align the Rust compiler version across all libs and executables to guarantee ABI compatibility.
Documentation
//! # dyn-loader
//!
//! Dynamic library loader with two plugin-loading modes:
//!
//! ## [`dyn`] — Rust fat-pointer bridge (trait objects)
//!
//! Load Rust trait objects from `.so`/`.dylib` plugins via their native
//! fat-pointer representation (data + vtable), with Arc-like retain/release
//! for cross-boundary memory safety.
//!
//! ```ignore
//! // In the plugin .so:
//! #[no_mangle]
//! pub extern "C" fn core_ast_transform_entry() -> AbiStableDynRef {
//!     SafeArcDyn::from_arc(Arc::new(MyTransform) as Arc<dyn Transform>).into_abi()
//! }
//!
//! // In the host:
//! use dyn_loader::dyn::{DynPlugin, AbiStableDynRef};
//! let plugin = DynPlugin::<dyn Transform>::load("libmy_transform.so", b"core_ast_transform_entry\0")?;
//! let transform: &dyn Transform = plugin.trait_ref();
//! ```
//!
//! ## [`cdyn`] — COM-style C function tables (ABI-stable)
//!
//! Load plain C function-table structs (`#[repr(C)]` Copy types) via
//! positional dispatch — no trait objects, stable across languages and
//! (to a large extent) compiler versions. This is the former `cdyn-loader`
//! crate, merged here as `VTablePlugin<T>`.
//!
//! ```ignore
//! let plugin = unsafe { VTablePlugin::<MyVtable>::load("libmy.so", b"my_get_vtable\0")? };
//! ```
//!
//! ## ⚠️ ABI compatibility / compiler version alignment
//!
//! Even though [`cdyn`] mode is layout-stable, the Rust compiler version must
//! still be strictly aligned across all libraries and executables that
//! exchange pointers across the boundary. Pin one toolchain (e.g. via
//! `rust-toolchain.toml`) and rebuild everything together. See the README for
//! the full cross-version compatibility matrix.

#[path = "dyn.rs"]
pub mod dyn_mod;
pub mod cdyn;
mod helpers;

pub use dyn_mod::{
    AbiDynFatPtr, AbiStableDynRef, DynPlugin, PluginEntryPoint, ReleaseFn, RetainFn, SafeArcDyn,
    pack_fat_ptr, unpack_fat_ptr,
};
pub use cdyn::{
    CdynBox, CdynBoxHandle, CdynHandle, GeneratedFunction, MathModuleVtable, MathSession,
    PluginDynEntryPoint, VTablePlugin, cdyn_box_free_rust,
};
pub use helpers::{DynLib, looks_like_plugin};