Skip to main content

WRAPPER_GEN_ENV

Constant WRAPPER_GEN_ENV 

Source
pub(crate) const WRAPPER_GEN_ENV: &str = "MINIEXTENDR_WRAPPER_GEN";
Expand description

Env var the Makevars wrapper-gen recipe sets before dyn.loading the freshly-built shared object to generate R/*-wrappers.R.

Loading the installed .so/.dll runs R_init_<pkg> on every platform, but during wrapper-gen that image is dyn.unloaded immediately afterwards. So when this var is present, init takes a minimal path: package_init skips the panic hook / locale / ALTREP+mx_abi setup, and miniextendr_register_routines skips ALTREP class registration — none of which must plant a pointer into an about-to-be-unloaded image (doing so risks the “malloc unsorted double linked list” heap corruption that macOS hides but Linux R aborts on).

SINGLE SOURCE OF TRUTH: both read-sites go through wrapper_gen_mode so the name can’t drift between them. Presence-based — any value (even empty) enables it — so it MUST NOT leak into a real package-load environment, or the package loads silently degraded (no panic hook, no ALTREP classes, no mx_abi).