cxxfunction中的多个插件

Gon*_*iao 5 r rcpp

我想同时使用RcppGSL和RcppArmadillo,是否可以在cxxfunction(内联CRAN软件包的)中使用多个插件?我找到了一种方法:

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")
Run Code Online (Sandbox Code Playgroud)

但似乎不那么直观。

Dir*_*tel 3

好问题。(在 rcpp-devel 上会更好。)

我认为你需要编写自己的组合插件,请参阅 Rcpp-FAQ 小插图的问题 3.6“如何为内联包编写插件”了解详细信息。