Skip to main content

export_last_error_abi

Macro export_last_error_abi 

Source
macro_rules! export_last_error_abi {
    ($slot:path, $message_fn:ident, $kind_fn:ident) => { ... };
}
Expand description

Declare <name>_last_error and <name>_last_error_kind over a LastErrorSlot.

The function names are passed in full rather than derived from a prefix, because macro_rules! cannot concatenate identifiers and an exported symbol is not worth a proc-macro dependency. Spelling them out also means the symbol appears literally in the source, which is what someone greps for.

use unparser_shared::ffi::LastErrorSlot;

thread_local! {
    static LAST_ERROR: LastErrorSlot = const { LastErrorSlot::new() };
}

unparser_shared::export_last_error_abi!(LAST_ERROR, mylib_last_error, mylib_last_error_kind);