[Rcpp-devel] Loading Rcpp modules from dynamic library
braunm at MIT.EDU
Sun Feb 26 01:11:11 CET 2012
No, what I would like to do is access an Rcpp module from a dynamic library that is not part of a R package (e.g., loaded using dyn.load() ). If I put the code in a package, there is no problem. But what I am getting is:
Error in Module(module, mustStart = TRUE) :
Failed to initialize module pointer: Error in FUN("_rcpp_module_boot_adding"[[1L]], ...): no such symbol _rcpp_module_boot_adding in package .GlobalEnv
The packages that you reference are all, well, packages, and from what I can tell about .onLoad(), that applies only to packages. And the loadRcppModules function, apparently, must be called from an .onLoad function (because I get an error message to that effect).
I have never had a problem loading compiled functions this way; it appears to be only an issue with modules.
I would appreciate some helpful suggestions from anyone in R-land who may have had some success with this (e.g., specific documentation pages to look at, code snippets that have worked for others, or other useful suggestions on what to try next). Of course, if what I want to do is known to be impossible, that would also be a helpful response.
On Feb 25, 2012, at 3:24 PM, Dirk Eddelbuettel wrote:
> Hi Michael,
> On 25 February 2012 at 19:45, Michael Braun wrote:
> | Hi. I would like to start using Rcpp modules in my code, but I am having some
> | trouble loading them into R. Here is an example:
> My personal approach is to follow the path of least resistance on __start
> from an existing package__ having the feature I want to use.
> Rcpp comes with modules-using packages as part of the documentation (Rcpp
> modules vignette) and unit tests. And there is even a package skeleton
> generator (for which you can set an option to use modules).
> And among the now 55 CRAN packages using Rcpp (!!), a few use modules
> too. One is my RcppBDT package, there are the two packages by Baptiste (cda,
> planar) and probably a few more but one can't tell from the DESCRIPTION.
> Your code may have been fine, but you also need to look at the .onLoad or
> .onAttach function etc. So starting from a working stanza really strikes me
> as easiest.
> Hth, 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
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 1844 bytes
Desc: not available
More information about the Rcpp-devel