Expand description
Unified runtime for #[export]-marked Wolfram LibraryLink functions.
Pick modes via Cargo features:
wolfram-export = { version = "0.5", features = ["wxf"] } # typed WXF
wolfram-export = { version = "0.5", features = ["wstp"] } # WSTP Link
wolfram-export = "0.5" # native (default)Then in your code:
ⓘ
use wolfram_export::export;
#[export] fn add(a: f64, b: f64) -> f64 { a + b }
#[export(wstp)] fn foo(link: &mut Link) { /* ... */ }
#[export(wxf)] fn dot(a: Vec<f64>, b: Vec<f64>) -> f64 { /* ... */ }Each mode’s wire shape, runtime, and Cargo dep set live in its own
feature-gated submodule below. The ExportEntry inventory and the
__wolfram_manifest__ C symbol are always on (they’re tiny and how the
cargo wl build tool discovers exports).
Modules§
- macro_
utils - Macro-runtime helpers. Re-exports of the per-mode
macro_utilsmodules behind a singlewolfram_export::macro_utils::*namespace so the proc-macro can emit one consistent path regardless of mode. - native
- Runtime support for
#[export]-marked native (MArgument-based) LibraryLink functions. - sys
- Raw
wolfram-library-link-sysC-FFI types (WolframLibraryData,MArgument,mint, …). Available whenever any LibraryLink-using mode is enabled.
Enums§
- Export
Entry - Inventory entry for one
#[export]-marked function.
Traits§
- Native
Function - Trait implemented for any function whose parameters and return type are native
LibraryLink
MArgumenttypes.
Functions§
- exported_
library_ functions_ association - Returns an
Associationcontaining the names andLibraryFunctionLoadcalls for every#[export(..)]-marked function in this library.
Attribute Macros§
- export
- Back-compat
#[export]/#[export(wstp)]proc-macro: dispatches by thewstpkeyword inattrs. Used by thewolfram_library_link::exportre-export so existing call sites compile unchanged — emitted code paths resolve through::wolfram_library_link::*. - export_
native - Annotate a function for export via the native (MArgument-based) Wolfram
LibraryLink ABI. Re-exported by
wolfram-export-nativeasexport. - export_
wstp - Annotate a function for export via the WSTP
LinkObjectABI. Re-exported bywolfram-export-wstpasexport. - export_
wxf - Annotate a function for export via the WXF (typed-arg) ABI. The wrapper
reads a
ByteArrayMArgument containing a WXF-encoded payload, deserializes viaFromWolfram, calls the user function, serializes the return value, and writes aByteArrayMArgument back. Re-exported bywolfram-export-wxfasexport. - init
- Mark a function as the library’s
WolframLibrary_initialize()entry point.