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. Install panic hook for better error messages
  2. Record main thread ID (and optionally spawn worker thread)
  3. Assert UTF-8 locale
  4. Set ALTREP package name
  5. Register mx_abi C-callables for cross-package trait dispatch
  6. Register all #[miniextendr] routines and ALTREP classes
  7. Lock down dynamic symbols

§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).