[Rcpp-devel] How do I load a rcpp module?

Glenn Lawyer lawyer at mpi-inf.mpg.de
Mon Mar 12 10:26:25 CET 2012


Dear List,

I am working through the vingette "Exposing C++ functions and 
classes with Rcpp modules," and am stuck at section 2.2.1.

I create a text file with the code for the Uniform class, and 
successfully compile it with R CMD SHLIB.

Can you please tell me how to load it into R so that I can 
continue with the example? The vingette clearly shows how to use 
it once everything is set up, but does not show how to set things up.

This is, in fact, my main frustration with all of the rcpp 
documentation. It consistently assumes a high level of 
sophistication from its users. Almost none of the examples work 
"as is", nor do they give hints as to what information is missing. 
For example, the c++ code as given in the example does not 
compile. The reader has to know to add an include directive. This 
is mentioned nowhere in the vingette. Or my case, where I need to 
know how to load the module. Again, this is never described.

Likewise, with the first example (section 2.1), the given R 
commands fail:
 > require( Rcpp )
Loading required package: Rcpp
 > mod <- Module( "mod" )
 > mod$norm( 3, 4 )
Error in Module(module, mustStart = TRUE) :
   Failed to initialize module pointer: Error in 
FUN("_rcpp_module_boot_mod"[[1L]], ...): no such symbol 
_rcpp_module_boot_mod in package .GlobalEnv

Nor do I see where (or how?) the dynamic library containing the 
compiled norm function is loaded.

+glenn


-- 
-----------------------------------
It is difficult to find a black cat in a dark room,
especially if there is no cat.
   -- Chinese proverb

   Dr. Glenn Lawyer
   +352 661 967 244
   Max-Planck-Institut für Informatik
   Computational Biology and Applied Algorithmics
   Campus E1 4
   66123 Saarbrücken, Germany
   http://bioinf.mpi-inf.mpg.de/~lawyer


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20120312/1c8c741d/attachment.html>


More information about the Rcpp-devel mailing list