[Rcpp-commits] r3931 - in pkg/Rcpp: . R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Nov 10 21:13:01 CET 2012


Author: jjallaire
Date: 2012-11-10 21:13:01 +0100 (Sat, 10 Nov 2012)
New Revision: 3931

Modified:
   pkg/Rcpp/ChangeLog
   pkg/Rcpp/R/Attributes.R
Log:
ensure function definitions are never stale

Modified: pkg/Rcpp/ChangeLog
===================================================================
--- pkg/Rcpp/ChangeLog	2012-11-10 20:00:39 UTC (rev 3930)
+++ pkg/Rcpp/ChangeLog	2012-11-10 20:13:01 UTC (rev 3931)
@@ -1,5 +1,6 @@
 2012-11-10  JJ Allaire <jj at rstudio.org>
 
+        * R/Attributes.R: ensure function definitions are never stale
         * src/Attributes.cpp: add optional hook for inclusion of package types
         * examples/Attributes/Export.cpp: example use of Rcpp::export
         * examples/Attributes/Depends.cpp: example use of Rcpp::depends

Modified: pkg/Rcpp/R/Attributes.R
===================================================================
--- pkg/Rcpp/R/Attributes.R	2012-11-10 20:00:39 UTC (rev 3930)
+++ pkg/Rcpp/R/Attributes.R	2012-11-10 20:13:01 UTC (rev 3931)
@@ -81,10 +81,8 @@
         
         # unload and delete existing dylib if necessary
         if (file.exists(context$dynlibPath)) {
-            try(silent=TRUE, {
-                dyn.unload(context$dynlibPath)
-                file.remove(context$dylibPath)
-            })
+            dyn.unload(context$dynlibPath)
+            file.remove(context$dylibPath)
         }
            
         # prepare the command (output if we are in showOutput mode)
@@ -130,6 +128,9 @@
     
     # load the module if we have exported functions (else there is no module)
     if (length(context$exportedFunctions) > 0) {
+        # remove existing objects of the same name from the environment
+        remove(list = context$exportedFunctions, envir = env)
+        # load the module and populate the target environment
         dll <- dyn.load(context$dynlibPath)
         populate(Module(context$moduleName, PACKAGE = dll, mustStart = TRUE), 
                  env)



More information about the Rcpp-commits mailing list