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

Ivan Krylov kry|ov@r00t @end|ng |rom gm@||@com
Wed Jun 1 22:14:17 CEST 2022


On Wed, 1 Jun 2022 11:03:48 +0200
THIOULOUSE JEAN <Jean.Thioulouse using univ-lyon1.fr> wrote:

> Do I have to modify the init.c file in the src directory ? It
> contains the reference to all the C functions called in the ade4
> package, but not the C++ function from Rcpp. Should I add it here ? I
> tried to do it, with no luck.

Yes, this is likely the right thing to do. Can you commit your pending
modifications to ade4 in a separate branch to let everyone look at it?
What you describe sounds right. There's probably some small detail
you're missing.

> Why is the _ade4_RVrandtestCpp function (defined by
> compileAttributes() in RcppExports.cpp) not visible in RVrandtestCpp
> and not found at runtime ?

It has to be mentioned in a struct R_CallMethodDef entry, passed to the
third argument of R_registerRoutines() in your R_init_ade4 function in
src/init.c.

-- 
Best regards,
Ivan



More information about the R-package-devel mailing list