Skip to main content

Module cdyn

Module cdyn 

Source
Expand description

§cdyn — COM-style C function-table loading (ABI-stable)

Load Copy-sized vtable/descriptor structs from dynamic libraries using plain C function tables — no Rust trait objects, no named-based access, purely positional dispatch. This is the COM+-like emulated vtable system (formerly the separate cdyn-loader crate).

Unlike crate::dyn_mod, this mode is ABI-stable across languages: the C++ SDK (cdyn-loader-sdks/cpp) and Zig SDK (cdyn-loader-sdks/zig) build plugins that match these layouts exactly.

§Usage

#[repr(C)]
struct MyVtable {
    add: unsafe extern "C" fn(i32, i32) -> i32,
    name: unsafe extern "C" fn() -> *const std::ffi::c_char,
}

let plugin = unsafe { VTablePlugin::<MyVtable>::load("libmy.so", b"my_get_vtable\0")? };
let n = unsafe { (plugin.vtable().add)(1, 2) };

Structs§

CdynHandle
Ref-counted handle to a foreign plugin object exposed through a *_get_dyn style entry point returning an AbiStableDynRef.
GeneratedFunction
Descriptor for a generated math function (matches C++ GeneratedFunction)
MathModuleVtable
Vtable struct matching C++ MathModuleVtable layout exactly
VTablePlugin
Load a Copy-sized vtable/descriptor struct from a dynamic library.

Type Aliases§

MathSession
Opaque handle for a C++ MathSession
PluginDynEntryPoint
Type of the dyn entry point that foreign plugins export (C++ CDYN_EXPORT AbiStableDynRef name_get_dyn(), Zig declareDynEntry).