[R-pkg-devel] moving from C to C++ with Rcpp in R package

Ivan Krylov kry|ov@r00t @end|ng |rom gm@||@com
Thu Jun 2 15:24:20 CEST 2022


В Thu, 2 Jun 2022 15:06:44 +0200
THIOULOUSE JEAN <Jean.Thioulouse using univ-lyon1.fr> пишет:

> "object '_ade4_RVrandtestCpp' not found").

> static const R_CallMethodDef CallEntries[] = {
>     {"_ade4_RVrandtestCpp", (DL_FUNC) &_ade4_RVrandtestCpp, 3},
>     {NULL, NULL, 0}
> };

Almost there. Since you're using the fixes = 'C_' argument to
useDynLib, you need to .Call() the variable called C__ade4_RVrandtestCpp
in your R code, not _ade4_RVrandtestCpp.

You can verify the symbol name by installing the package and searching
for it in the package namespace:

grep(
 'rv.*randtest', ls(loadNamespace('ade4'), all = TRUE),
 ignore.case = TRUE, value = TRUE
)

Unfortunately, this means editing RcppExports.R, which (I think)
prevents you from enjoying the way Rcpp::compileAttributes() sets
everything up for you.

-- 
Best regards,
Ivan



More information about the R-package-devel mailing list