[Rcpp-devel] calling a homegrown cpp function from my own package when using sourceCpp

Søren Højsgaard sorenh at math.aau.dk
Mon Dec 30 02:59:17 CET 2013


Dear all,

I have created a function c++ function foo which I export with //[[Rcpp::export]]. I've put the file foo.cpp with the function into the src dir of the package mypack; I've run compileAttributes and I can see the function in mypack_RcppExport.h and the automatically generated interface to the function is available in R (these Rcpp-attributes really make life easier).

Now I want to develop another function bar in the file bar.cpp and bar depends on foo. I want to develop bar using sourceCpp("bar.cpp") but I can not figure out how to make my c++ function foo available to bar. In bar.cpp I have 
//[[Rcpp::depends(mypack)]] but that does not make foo available.

Is it possible to do what I want (I believe it is from the documentation?) or is there another "workaround"??

Happy new year - and thanks in advance!

Best regards
Søren






More information about the Rcpp-devel mailing list