Skip to main content

miniextendr_init

Macro miniextendr_init 

Source
miniextendr_init!() { /* proc-macro */ }
Expand description

Generate the R_init_* entry point for a miniextendr R package.

This macro consolidates all package initialization into a single line. It generates an extern "C-unwind" function that R calls when loading the shared library.

§Usage

ⓘ
// Auto-detects package name from CARGO_CRATE_NAME (recommended):
miniextendr_api::miniextendr_init!();

// Or specify explicitly (for edge cases):
miniextendr_api::miniextendr_init!(mypkg);

The generated function calls miniextendr_api::init::package_init which handles panic hooks, runtime init, locale assertion, ALTREP setup, trait ABI registration, routine registration, and symbol locking.

Call it at the crate root: it also defines the crate’s marker type, under which serde_error_shape! declarations are keyed and which, with the API’s serde feature, every #[miniextendr] function or method returning a Result names.