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

Jean Thioulouse je@n@th|ou|ou@e @end|ng |rom un|v-|yon1@|r
Thu Jun 2 19:00:17 CEST 2022


Thanks a lot ! Package compiles and runs fine now. I must keep the  .fixes = "C_" argument in the useDynLib function of the NAMESPACE file because there are still many C functions in the package. So adding C_ to Rcpp function names is a good workaround for now.

Thanks again
Jean


> Le 2 juin 2022 à 15:24, Ivan Krylov <krylov.r00t using gmail.com> a écrit :
> 
> В 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