Several plugins in cxxfunction

I want to use RcppGSL and RcppArmadillo at the same time, is it possible to use several plugins in cxxfunction (built-in CRAN package)? I found a way to do:

plug.ArmaGSL <- Rcpp:::Rcpp.plugin.maker(include.before='#include <RcppArmadillo.h> #include <RcppGSL.h> #include <gsl/gsl_rng.h>', Depends=c("RcppGSL", "RcppArmadillo", "Rcpp"), LinkingTo=c("RcppGSL", "RcppArmadillo", "Rcpp"), libs="-lgsl -larmadillo") registerPlugin("RcppArmaGSL", plug.ArmaGSL) foo <- cxxfunction(signature(sM="numeric"), body=bodytxt, inc=inctxt, plugin="RcppArmaGSL") 

but it does not seem intuitive.

+4
source share
2 answers

Good question. (And it would be even better on rcpp-devel.)

I think you need to write your own combined plug-in, see question 3.6 "How to write a plug-in for the built-in package" of the Rcpp-FAQ vignette for details.

+2
source

An easy way is to start with an existing plugin, say:

 require(inline) require(RcppArmadillo) foo <- getPlugin("RcppArmadillo" ) 

and then mess with foo and use it as an argument of parameters in a cxxfunction call. More on this at. Cxxfunction.

+2
source

Source: https://habr.com/ru/post/1392546/


All Articles