[Rcpp-devel] object '.pointer' not found

Romain Francois romain at r-enthusiasts.com
Thu Dec 2 20:24:14 CET 2010


Le 02/12/10 20:05, Andrew Redd a écrit :
> I updated to the new Rcpp 0.8.9 then added a new function to my class.
>   It compiles fine the Module is found and loads the class definition
> seems to be there, but when I try to create a instance of the class I
> get the error:
>
> R> new(Module("GPU_BAYES",'gpuBayes')$data3)
> Error in get(".pointer", envir = env) : object '.pointer' not found
>
> Any Ideas what might be wrong here?  That's a rather vague error.  The
> traceback gives
>
>  > traceback()
> 3: get(".pointer", envir = env)
> 2: function (object)
>     standardGeneric("show")(<S4 object of class "Rcpp_data3">)
> 1: function (object)
>     standardGeneric("show")(<S4 object of class "Rcpp_data3">)
>
>
> Thanks,
> Andrew

In the Rcpp-modules vignette, that has been considerably updated in the 
last version of Rcpp (part of the 8661 new lines of code), we suggest to 
have this in your .onLoad:

# grab the namespace
NAMESPACE <- environment()

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

and the "data3" class is directly exposed in the namespace of your 
package, so that you can do:

new( data3 )

Does that work ?


Otherwise, maybe you can try adding mustStart = TRUE to the call to Module.

-- 
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://bit.ly/hovakS : RcppGSL initial release
|- http://bit.ly/iaxTdO : parser 0.0-12
`- http://bit.ly/gnCl01 : Rcpp 0.8.9




More information about the Rcpp-devel mailing list