[Rcpp-devel] Bug: compileAttributes incorrectly handles Rcpp::export-ed functions with multiple arguments

Dirk Eddelbuettel edd at debian.org
Fri Jan 17 23:55:40 CET 2014


Davor,

On 17 January 2014 at 14:47, Davor Cubranic wrote:
| When compileAttributes comes across an export-ed C++ function that has one or more attributes, it generates two versions of it in RcppExports.cpp and RcppExports.R: one with the correct arguments, and one with no arguments. Does anyone else see this? I'm attaching a simple package created with Rcpp.package.skeleton("myPackage", attributes = TRUE), which I then edited to add a parameter "NumericVector z" to function "rcpp_hello_world" and manually rerun "compileAttributes()".

You had two mistakes here:

  i)   after you alter an interface to be used by Rcpp Attributes, you must
       re-run the compileAttributes() function to update the files.  See the
       vignette for details.

       (And if you use RStudio, this is done automagically)

  ii)  Your C++ function did not work as the 'List z = ...' parameter
       shadowed an already declared parameter from the function interface.
       Renaming to zz or z2 works, of course.

Doing i) and ii) lets you build the package as expected.

Dirk

-- 
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com


More information about the Rcpp-devel mailing list