On 6 March 2015 at 17:09, JJ Allaire wrote: | The overhead comes from the fact that the parameters are converted | to/from SEXP and pushed through a C interface. There's also overhead | that's associated with error checking, etc. This is a fixed overhead | so as more work gets done inside your C++ function the % overhead will | approach zero. | | In terms of re-using code across packages, everything in your | inst/include directory is automatically added to the include search | path of any package that has a LinkingTo relationship to yours (and to | any sourceCpp module that does an Rcpp::depends on it). No absolute | paths are therefore necessary (R resolves the path to your package at | build time). | | If you want to re-use Rcpp code across packages the most | straightforward way to do it is inside a header file (this has no | linking or associated C interface overhead, and has no versioning | problems). You can just define your function with the 'inline' keyword | and it can be re-used in an arbitrary number of other C++ files with | no linker conflicts.
"What JJ said." Coincidentally, the same questin came up at StackOverflow yesterday, with a wrong initial Subject: asking for header-onlu and only later revealing that full linking was required. In bits and pieces I answerd something very similar to what JJ says here: http://stackoverflow.com/questions/28883314/rcpp-include-header-from-package-into-cppfunction Dirk -- http://dirk.eddelbuettel.com | @eddelbuettel | e...@debian.org _______________________________________________ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel