Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upApparent fragility in Rcpp use when not calling importFrom(Rcpp, somesymbol) #1030
Comments
|
Are we sure this related to the use of IIUC that error means that R wasn't able to find the R-level object acting as a pointer to the C-level entrypoint, which makes me think something "weird" happened to Rcpp during tests. More directly, it means a call to And we definitely register these routines here: Lines 88 to 125 in e77e79c So I'm not exactly sure what's going on. |
|
Definitely not sure what is going on either, but just thought that it was something we did not change but which R may have changed? That part of |
|
Took another look, and it could definitely also be that the 'compiling' branch no longer activates. I would not know why. Simple tests work for me: R> cppFunction("bool getIt(NumericVector x) { void *ptr = dataptr(x); return ptr!=nullptr; }")
R> getIt(rnorm(5))
[1] FALSE
R> |
|
I think it is the use of Rcpp in the affected package. E.g. in the first one I looked, I noticed it did not have an diff -ru BatchMap.orig/DESCRIPTION BatchMap/DESCRIPTION
--- BatchMap.orig/DESCRIPTION 2017-11-12 00:55:01.000000000 +0100
+++ BatchMap/DESCRIPTION 2019-12-05 14:39:13.450765159 +0100
@@ -15,7 +15,7 @@
"augusto.garcia@usp.br"))
LinkingTo: Rcpp (>= 0.10.5), RcppArmadillo (>= 0.7.700)
Depends: parallel (>= 3.2.3), ggplot2 (>= 1.0.1), R (>= 3.2.0)
-Imports: reshape2 (>= 1.4.1), methods
+Imports: reshape2 (>= 1.4.1), methods, Rcpp
Suggests: knitr (>= 1.10), rmarkdown
VignetteBuilder: knitr
Encoding: UTF-8
diff -ru BatchMap.orig/NAMESPACE BatchMap/NAMESPACE
--- BatchMap.orig/NAMESPACE 2017-10-30 17:44:39.000000000 +0100
+++ BatchMap/NAMESPACE 2019-12-05 14:32:23.872820158 +0100
@@ -10,6 +10,7 @@
"median", "na.omit", "qchisq", "sd")
importFrom("utils", "flush.console", "head", "setTxtProgressBar",
"tail", "txtProgressBar")
+importFrom("Rcpp", "evalCpp")
## Export all names
exportPattern(".")
|
|
That makes sense to me. We've documented using |
|
Indeed. And when I looked at the package, it still had some older school direct use of SEXP, using .Call() with the symbol quoted and package name listed etc pp. In that case I think one simply needs it. |
|
I just added to the Rcpp FAQ for this. PR coming in a moment, have a look at that to see if the writing I added is sufficient. |
recommend importFrom in Rcpp FAQ (closes #1030)
I am currently running some reverse depends checks for a new RcppArmadillo minor release, and noticed a view package bonking in tests on
function 'dataptr' not provided by package 'Rcpp'.This relates to our file
inst/include/Rcpp/routines.hwhich has it, but also carries a commentand that may recently have changed in R.
Do we care? Should we care?
Should we remove the now-no-longer empty
attribute_hiddendefine in front ofdataptr()and a number of other helpers?