I'm looking over the demo provided in 3.6 of the Rcpp-FAQ, and I'm trying to understanding how this plugin is being created. The standalone example provided is
gslrng <-
'int seed = Rcpp::as<int>(par) ;
gsl_rng_env_setup();
gsl_rng *r = gsl_rng_alloc (gsl_rng_default);
gsl_rng_set (r, (unsigned long) seed);
double v = gsl_rng_get (r);
gsl_rng_free(r);return Rcpp::wrap(v);'
plug <- Rcpp:::Rcpp.plugin.maker(
include.before = "#include <gsl/gsl_rng.h>",
libs = paste("-L/usr/local/lib/R/site-library/Rcpp/lib -lRcpp",
"-Wl,-rpath,/usr/local/lib/R/site-library/Rcpp/lib",
"-L/usr/lib -lgsl -lgslcblas -lm"))
registerPlugin("gslDemo", plug )
fun <- cxxfunction(signature(par="numeric"), gslrng, plugin="gslDemo")
fun(0)
Specifically, why is that call to paste()
being comma-separated like that? Should all dependencies (header file directories, linker directories, and name of library files) be handled via plugins?