<div dir="ltr"><div><div>Hi Kevin,<br></div>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.<br><br></div>
<div>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).<br><br></div><div>Thanks<br><br></div><div>Finlay<br></div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Thu, Jul 3, 2014 at 4:16 PM, Kevin Ushey <span dir="ltr"><<a href="mailto:kevinushey@gmail.com" target="_blank">kevinushey@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Finlay,<br>
<br>
I'm unable to reproduce this on Mac OS X, although I am running the<br>
development version of devtools. Can you try that?<br>
<br>
That said, if you still have this problem after updating I would<br>
recommend posting it at <a href="https://github.com/hadley/devtools/issues" target="_blank">https://github.com/hadley/devtools/issues</a> as<br>
even if there is a problem, I don't think it's an Rcpp one.<br>
<br>
Cheers,<br>
Kevin<br>
<br>
> sessionInfo()<br>
R Under development (unstable) (2014-07-01 r66058)<br>
Platform: x86_64-apple-darwin13.2.0 (64-bit)<br>
<br>
locale:<br>
[1] en_CA.UTF-8/en_CA.UTF-8/en_CA.UTF-8/C/en_CA.UTF-8/en_CA.UTF-8<br>
<br>
attached base packages:<br>
[1] stats     graphics  grDevices utils     datasets  methods   base<br>
<br>
other attached packages:<br>
[1] NewPackage_1.0       Rcpp_0.11.2          knitr_1.6<br>
[4] devtools_1.5.0.99    BiocInstaller_1.15.3<br>
<div><div class="h5"><br>
On Thu, Jul 3, 2014 at 2:27 AM, Finlay Scott <<a href="mailto:drfinlayscott@gmail.com">drfinlayscott@gmail.com</a>> wrote:<br>
> Hi,<br>
><br>
> First of all, thanks for all the hard work that has been put into Rcpp. It<br>
> really is a great package.<br>
><br>
> I'm redeveloping a package I was working on last year that uses Rcpp,<br>
> particularly attributes. I used the devtools package to help with the<br>
> development process. My general development approach was to add or change a<br>
> function with attributes in the C++ source code, and then reload the package<br>
> using the devtools function load_all(). This would recompile the source<br>
> code, and update the RcppExports.R and .cpp files as necessary. The new<br>
> exported function would then be immediately available to the current R<br>
> session.<br>
><br>
> I have now updated all my R packages and am using Rcpp 0.11.2.<br>
> Unfortunately, the behaviour of load_all() is now different. For example, if<br>
> I start a new package from scratch:<br>
><br>
> library(Rcpp)<br>
> Rcpp.package.skeleton("NewPackage", attributes = TRUE)<br>
><br>
> # Then load devtools and use load_all()<br>
><br>
> library(devtools)<br>
> load_all("NewPackage")<br>
><br>
> # The demo function works just fine<br>
><br>
> rcpp_hello_world()<br>
><br>
> # 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>
> # I rerun load_all()<br>
><br>
> load_all("NewPackage")<br>
><br>
> # The package recompiles, and I can see that the resulting *.o and *.so have<br>
> been updated.<br>
> # However, calling rcpp_hello_world() still returns the old output, i.e. the<br>
> function called from R does not seem to have been updated.<br>
> # Similarly, if I add a new simple function with attributes to<br>
> rcpp_hello_world.cpp<br>
> # For example:<br>
><br>
> // [[Rcpp::export]]<br>
> int do_nothing(){<br>
>     return 0;<br>
> }<br>
><br>
> # If I call load_all() again, the package compiles and the RcppExports.R and<br>
> .cpp files have been updated to include this new function (i.e. it looks<br>
> like compileAttributes() has been called by load_all()).<br>
> # 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>
> So it looks like load_all() is updating and recompiling the package<br>
> accordingly, but it is not being 'reloaded' in the current R session.<br>
><br>
> I ran a test using Rcpp 0.10.6 and the latest devtools (1.5) and the above<br>
> tests passed (i.e. after running load_all() the new function was available<br>
> to the current R session), so the problem seems to be with Rcpp > 0.11.0<br>
><br>
> Does anyone else have experience of this, and a workaround?<br>
><br>
> Apologies if this is more of a devtools question than an Rcpp one. I will<br>
> repost at the devtools mailing list if necessary.<br>
><br>
> I am using Ubuntu 14.04 , R 3.1.0; x86_64, devtools 1.5<br>
><br>
> Thanks<br>
><br>
> Finlay<br>
><br>
><br>
</div></div>> _______________________________________________<br>
> Rcpp-devel mailing list<br>
> <a href="mailto:Rcpp-devel@lists.r-forge.r-project.org">Rcpp-devel@lists.r-forge.r-project.org</a><br>
> <a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel</a><br>
</blockquote></div><br></div>