Skip to main content

Crate wolfram_export_macros

Crate wolfram_export_macros 

Source
Expand description

Procedural macros for #[export] and #[init].

Emitted paths are resolved dynamically at expansion time via proc-macro-crate: if the caller’s Cargo.toml has wolfram-export the macro emits ::wolfram_export::*; if it has wolfram-library-link (legacy) it emits ::wolfram_library_link::*. Both crates expose the same hidden runtime surface so generated code resolves correctly in both cases.

Attribute Macros§

export
Export a function as a Wolfram LibraryLink function, in one of four wire formats picked by a keyword argument. All four need LibraryFunctionLoad on the Wolfram side and none of them need the automate-function-loading-boilerplate feature to work — that feature only affects whether cargo wl build can discover the load call for you (#[export(margs)] needs an args =/ret = annotation for that discovered call to be correct — see below).
init
Designate an initialization function to run once, when this library is loaded via Wolfram LibraryLink — distinct from [export], which wraps a function called on every invocation from Wolfram.