[Rcpp-devel] devtools load_all() and modules

Dirk Eddelbuettel edd at debian.org
Tue Mar 20 18:16:08 CET 2012

Hi Chris,

On 20 March 2012 at 00:10, Chris DuBois wrote:
| Hi all,
| I'm trying out Hadley's devtools package.  I'm having trouble using
| load_all() on a package which uses Rcpp modules.  From the readme,
| this function "simulates installing and reloading your package, by
| loading R code in R/, compiled shared objects in src/and data files in
| data/. During development you usually want to access all functions so
| load_all ignores the package NAMESPACE. It works efficiently by only
| reloading files that have changed."
| When I use it for my package, I get:
| Error in loadRcppModules() :
|   loadRcppModules can only be used within a .onLoad function
| Is there a way to load Rcpp modules from outside an .onLoad function?

There is the 

      res <- dyn.load("somefile.so")
      mod <- Module( "mod", PACKAGE=res)      

trick that come up here a few times which may help.
| I reported the issue here
| (https://github.com/hadley/devtools/issues/61), but Hadley said I
| should ask this group.

I think I will simply push this problem back to you and Hadley.  

Rcpp modules is documented in its own vignette (which, surely, can always be
enhanced; we have a pending patch by Glenn Lawyer).  

For usage beyond what we document and test, you're on your own.  If you want
to explore usage with devtools and other means, go for it.  

But I will be unlikely to have time to work this out for you, unfortunately.

Sorry,  Dirk

"Outside of a dog, a book is a man's best friend. Inside of a dog, it is too
dark to read." -- Groucho Marx

More information about the Rcpp-devel mailing list