[Rcpp-devel] [Rd] Newbie Rccp module question. "Failed to initialize module pointer"???

Dirk Eddelbuettel edd at debian.org
Fri Feb 18 16:10:44 CET 2011


(Now just on rcpp-devel)

I had another quick look at this yesterday and noticed 

On 17 February 2011 at 13:14, Dirk Eddelbuettel wrote:
| On 17 February 2011 at 10:29, Andre Zege wrote:
| | I then run Rcpp.package.skeleton("mypackage"), put fun.cpp in mypackage/src and 
| | did 

That is not enough. You have to actually get the symbols of your Module
loaded at package load, typically via function .onLoad() in R/zzz.R -- see
the Section 3 of the Rcpp-modules vignette entitled 'Using modules in other
packages'. It lists the populate() helper function, you can also it by hand
as the Rcpp.package.skeleton() generated code does:

.onLoad <- function(pkgname, libname){
	# load the module and store it in our namespace
	unlockBinding( "yada" , .NAMESPACE )
	assign( "yada",  Module( "yada" ), .NAMESPACE )
	lockBinding( "yada", .NAMESPACE )

You'd have to do the same for your test module.


Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com

More information about the Rcpp-devel mailing list