Skip to content
Prev 3592 / 10988 Next

[Rcpp-devel] suggested revision to module vingette

Not sure if this is the right place to send it or not, but 
according to the Rcpp homepage

"We now have a mailing list 
<http://lists.r-forge.r-project.org/pipermail/rcpp-devel/> for 
discussions around Rcpp. If you have ideas or suggested changes, 
send an email there."

I suggest modifying inst/doc/Rcpp-modules/Rcpp-modules.Rnw in two 
places, as indicated in the text below and in the attached version 
of Rcpp-modules.Rnw

The motivation for the change is that the R code as shown in the 
vingette does not load the compiled code, and thus fails. It is 
not otherwise clear from the vingette how to load compiled code. 
It is also not clear from the unit tests, as these rely on inline 
compilation i.e.
    fx <- cxxfunction( signature(), "" , include = inc, plugin = 
"Rcpp" )
    mod <- Module( "yada", getDynLib(fx) )

###################################
First suggested change
###################################
305,306d304
< For this brief example, assume the code has been compiled as 
``test.so'' using R CMD SHLIB. In general, however, we recommend 
the use of packages.
<
312c310
< mod <- Module( "mod", PACKAGE=dyn.load( "test.so" ) )
---
 > mod <- Module( "mod" )


###################################
Second suggested change -- please make sure the R code is correct, 
and the comments should be removed
###################################

360c358
< Assuming this code is contained in package myPackage, then the 
functions are available in \proglang{R} via:
---
 > and can then be used from \proglang{R}:
364,365c362,363
< require( myPackage )       ## is this sufficient??
< yada <- Module( "yada" ) ## does this need to indicate the package??
---
 >
 > yada <- Module( "yada" )

###################################