Dear list, In the process of writing a comprehensive unit testing application for Rcpp I may have come across a bug in the code. It seems to me that the following block should execute just fine, exporting the C++ class "norm" to the global environment:
require(inline) require(Rcpp) inc <- ' using namespace Rcpp; double norm( double x, double y ) { return sqrt( x*x + y*y ); } RCPP_MODULE(mod) { function( "norm", &norm ); }' fx <- cxxfunction(signature(), plugin="Rcpp", include=inc) mod <- Module("mod", getDynLib(fx)) loadRcppClass('norm', 'norm', mod) What happens, though, is that the following error is returned: Error in as.environment(pos) : no item called "moduleName" on the search list D igging in to loadRcppClass , I find that the function fails at the line: mod <- loadModule(module, NULL, env = where, loadNow = TRUE) Entering loadModule , the function fails here, at the "get" statement: loadM <- as.environment(module) module <- get(loadM, "moduleName") Isn't this backward? get syntax is: get(x, pos = -1, envir = as.environment(pos), mode = "any", inherits = TRUE) Where "x" is the object sought in the specified environment. In this case, the function is failing because it can't find moduleName in the environment's search list, but the reason for this seems to be that the current statement is search for an environment within a character string, rather than a character string representing a named object within an environment. Is this in need of a patch, or am I missing something obvious? Cheers, Aaron
_______________________________________________ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel