[Rcpp-devel] USE_RINTERNALS and Rcpp
Dirk Eddelbuettel
edd at debian.org
Mon Sep 23 17:59:08 CEST 2013
On 23 September 2013 at 10:45, Hadley Wickham wrote:
| Is it possible to access the R internals api through Rcpp? For
Yes/No/Maybe.
If you peruse the ChangeLog for Rcpp you may notice see that we had to change
a few things over the years 'because "they" took them away'. That includes
silly things like the default (print) formatting of int, numeric and complex.
So where the R API says 'internal', CRAN is likely to slap your fingers.
Then again if you don't plan on going to CRAN, the world is your oyster but
even there they play games as a lot of the R code has functions carrying an
attribute setting it as non-visible. So no linking, and no soup for you.
Last resort, you can always copy the code (and, in the case of CRAN uploads,
risk being asked to make R Core your co-author even if it is just a helper
function).
| example, I want to right my own version of object.size() that's aimed
| at detecting memory leaks, so it needs to recursively include the size
| of environments. The objectsize C function needs to access R internals
| to get the size of various vectors (BYTE2VEC, INT2VEC etc) - is there
| a way to accomplish the same thing through Rcpp? (Source code for
| objectsize included below)
That may be doable.
It depends a little on what the macros expand to. Have you tried it yet?
Dirk
--
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
More information about the Rcpp-devel
mailing list