Skip to main content

package_init

Function package_init 

Source
pub unsafe fn package_init(dll: *mut DllInfo, pkg_name: &CStr)
Expand description

Initialize a miniextendr R package.

This performs all initialization steps in the correct order:

  1. Record main thread ID
  2. Enter R unwind protection and install the panic hook
  3. Set ALTREP package name
  4. Register mx_abi C-callables for cross-package trait dispatch
  5. Register all #[miniextendr] routines and ALTREP classes
  6. Lock down dynamic symbols

The package loads in any locale: string conversions translate per string (from_r::try_charsxp_to_str).

§Safety

Must be called from R’s main thread during R_init_*. dll must be a valid pointer provided by R. pkg_name must be a valid null-terminated C string that lives for the duration of the R session (typically a string literal).