Hi Kevin, Thanks for the reply. I tried using the development version of devtools but got the same result. I have access to a Windows machine here so will repeat my test on that.
I also think that it is more likely to do with devtools than Rcpp so I if don't make any progress I will post there (and report back here). Thanks Finlay On Thu, Jul 3, 2014 at 4:16 PM, Kevin Ushey <kevinus...@gmail.com> wrote: > Hi Finlay, > > I'm unable to reproduce this on Mac OS X, although I am running the > development version of devtools. Can you try that? > > That said, if you still have this problem after updating I would > recommend posting it at https://github.com/hadley/devtools/issues as > even if there is a problem, I don't think it's an Rcpp one. > > Cheers, > Kevin > > > sessionInfo() > R Under development (unstable) (2014-07-01 r66058) > Platform: x86_64-apple-darwin13.2.0 (64-bit) > > locale: > [1] en_CA.UTF-8/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-8/en_CA.UTF-8 > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > other attached packages: > [1] NewPackage_1.0 Rcpp_0.11.2 knitr_1.6 > [4] devtools_1.5.0.99 BiocInstaller_1.15.3 > > On Thu, Jul 3, 2014 at 2:27 AM, Finlay Scott <drfinlaysc...@gmail.com> > wrote: > > Hi, > > > > First of all, thanks for all the hard work that has been put into Rcpp. > It > > really is a great package. > > > > 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. > > > > 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: > > > > library(Rcpp) > > Rcpp.package.skeleton("NewPackage", attributes = TRUE) > > > > # Then load devtools and use load_all() > > > > library(devtools) > > load_all("NewPackage") > > > > # The demo function works just fine > > > > rcpp_hello_world() > > > > # I make a change to the source code of the rcpp_hello_world() function > > # For example, changing one of the values in the returned list > > # I rerun load_all() > > > > load_all("NewPackage") > > > > # The package recompiles, and I can see that the resulting *.o and *.so > have > > been updated. > > # However, calling rcpp_hello_world() still returns the old output, i.e. > the > > function called from R does not seem to have been updated. > > # Similarly, if I add a new simple function with attributes to > > rcpp_hello_world.cpp > > # For example: > > > > // [[Rcpp::export]] > > int do_nothing(){ > > return 0; > > } > > > > # 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()). > > # However, if I try to call do_nothing() from R I get: > > > > Error in .Call("NewPackage_do_nothing", PACKAGE = "NewPackage") : > > "NewPackage_do_nothing" not available for .Call() for package > "NewPackage" > > > > So it looks like load_all() is updating and recompiling the package > > accordingly, but it is not being 'reloaded' in the current R session. > > > > 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 > > > > Does anyone else have experience of this, and a workaround? > > > > Apologies if this is more of a devtools question than an Rcpp one. I will > > repost at the devtools mailing list if necessary. > > > > I am using Ubuntu 14.04 , R 3.1.0; x86_64, devtools 1.5 > > > > Thanks > > > > Finlay > > > > > > _______________________________________________ > > 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 >
_______________________________________________ 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