[Rd] calling R API functions after engine shutdown

Lukas Stadler lukas.stadler at oracle.com
Thu Sep 21 16:41:04 CEST 2017


Hi!

We’ve recently come across an example where a package (minqa) creates an Rcpp Function object in a static variable.
This causes R_ReleaseObject to be called by the destructor at a very late point in time - as part of the system exit function:

static Function cf("c");

I’m wondering if that is considered to be “safe”?
Is the R engine supposed to stay in a state where calls to API functions are valid, even after it has shut down?
It probably only ever happens with the ReleaseObject function, but even that could cause problems, e.g., with more elaborate refcounting schemes.

- Lukas


More information about the R-devel mailing list