<div dir="ltr"><div><div><div>Hi,<br><br></div><div>First of all, thanks for all the hard work that has been put into Rcpp. It really is a great package.<br></div><div><br></div>I'm redeveloping a package I was working on last year that uses Rcpp, particularly attributes. I used the devtools package to help with the development process. My general development approach was to add or change a function with attributes in the C++ source code, and then reload the package using the devtools function load_all(). This would recompile the source code, and update the RcppExports.R and .cpp files as necessary. The new exported function would then be immediately available to the current R session.<br>
<br></div>I have now updated all my R packages and am using Rcpp 0.11.2. Unfortunately, the behaviour of load_all() is now different. For example, if I start a new package from scratch:<br><br>library(Rcpp)<br>Rcpp.package.skeleton("NewPackage", attributes = TRUE)<br>
<br></div># Then load devtools and use load_all()<br><div><br>library(devtools)<br>load_all("NewPackage")<br><br></div><div># The demo function works just fine<br></div><div><br>rcpp_hello_world()<br><br></div><div>
# I make a change to the source code of the rcpp_hello_world() function<br># For example, changing one of the values in the returned list<br></div><div># I rerun load_all()<br></div><div><br>load_all("NewPackage")<br>
<br></div><div># The package recompiles, and I can see that the resulting *.o and *.so have been updated.<br></div><div># However, calling rcpp_hello_world() still returns the old output, i.e. the function called from R does not seem to have been updated.<br>
</div><div># Similarly, if I add a new simple function with attributes to rcpp_hello_world.cpp<br></div><div># For example:<br><br>// [[Rcpp::export]]<br>int do_nothing(){<br>    return 0;<br>}<br><br></div><div># If I call load_all() again, the package compiles and the RcppExports.R and .cpp files have been updated to include this new function (i.e. it looks like compileAttributes() has been called by load_all()).<br>
</div><div># However, if I try to call do_nothing() from R I get:<br><br>Error in .Call("NewPackage_do_nothing", PACKAGE = "NewPackage") : <br>  "NewPackage_do_nothing" not available for .Call() for package "NewPackage"<br>
<br></div><div>So it looks like load_all() is updating and recompiling the package accordingly, but it is not being 'reloaded' in the current R session.<br><br></div><div>I ran a test using Rcpp 0.10.6 and the latest devtools (1.5) and the above tests passed (i.e. after running load_all() the new function was available to the current R session), so the problem seems to be with Rcpp > 0.11.0<br>
<br></div><div>Does anyone else have experience of this, and a workaround?<br></div><div><br></div><div>Apologies  if this is more of a devtools question than an Rcpp one. I will repost at the devtools mailing list if necessary.<br>
<br></div><div>I am using Ubuntu 14.04 , R 3.1.0; x86_64, devtools 1.5 <br><br></div><div>Thanks<br><br></div><div>Finlay<br></div><div><br></div></div>