[Rcpp-devel] New to Rcpp - Can't get models to work

Kevin Ceder thuja at uw.edu
Thu Feb 23 17:36:04 CET 2012


I started digging to Rcpp yesterday as a way to plug a C++ class I wrote into R.  It looks like RCPP_MODULE is the way to go to expose the class.  However, while following the examples I can't get the modules to initialize.

I take the code from the first example in the Rcpp-Modules vignette:
#include "Rcpp.h"

using namespace Rcpp;

double norm( double x, double y ) {
return sqrt( x*x + y*y );
}
RCPP_MODULE(mod) {
function( "norm", &norm );
}
and compile into norm.dll.   Turning to R I use (following the example):

> require(Rcpp)
> mod <- Module("mod")
> mod$(3,4)
and get an error from R:
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

Any thoughts on where I'm going wrong here?

System info: Windows 7, R 2.14.1, Rcpp 0.9.10.

TIA,

kevin

"There is nothing - absolutely nothing - half so much worth doing as simply messing about in boats."
        ~Ratty (from Kenneth Grahame's, The Wind in the Willows)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Kevin R. Ceder
PhD Candidate
Stand Management Cooperative
School of Forest Resources
College of the Environment
University of Washington
Box 352100
Seattle, WA 98195
Phone: 206.543.0827
Fax: 206.685.0790
E-mail: thuja at uw.edu




More information about the Rcpp-devel mailing list