[Rcpp-devel] R.e. loadRcppModules

Romain Francois romain at r-enthusiasts.com
Tue Apr 12 08:11:47 CEST 2011


Le 12/04/11 04:15, Christian Gunning a écrit :
> On Mon, Apr 11, 2011 at 3:00 AM,
> <rcpp-devel-request at r-forge.wu-wien.ac.at>  wrote:
>>
>>
>> This will load the declared modules, and populate them into your
>> package's namespace.
>>
>> I will update the Rcpp-modules vignette accordingly.
>>
>> Suggestions, comments, improvements, "what are you  ? nuts !", ... are
>> always welcome.
>
> Works great for me -- very cool.
>
> One question that's been bothering me -- how are module-based objects
> *supposed* to behave across an R session quit/save/restart cycle? I'm
> seeing no persistence, and a consistent segfault.  Am I missing
> something here (perhaps wrt finalizer)?  If not, I'd like to add a
> note to the vignette...

Yes. This is a problem.

Not sure how this could be dealt with, but at least we should document 
that there is no persistence yet.

Romain

> Using the supplied example, I get:
>
> Rcpp.package.skeleton('testpkg1', module=T)
> require(testpkg1)
> modtest<- new(World)
> ## everything works
> show(modtest)
> modtest$set('hello')
> modtest$greet()
> q()
> ## Save workspace image? [y/n/c]: y
> ## exit, save, restart -- nothing works
>
> # [Previously saved workspace restored]
> #
> # During startup - Warning message:
> # Class "C++Object" is defined (with package slot ‘Rcpp’) but no
> metadata object found to revise subclass information---not exported?
> Making a copy in package ‘.GlobalEnv’
>
> require(testpkg1)
> modtest$greet()
> #Error in .External(list(name = "CppMethod__invoke_notvoid", address =
> <pointer: (nil)>,  :
> #  NULL value passed as symbol address
>
> show(modtest)
>
>   *** caught segfault ***
> address 0x8, cause 'memory not mapped'
>
> Traceback:
>   1: .Call(Class__name, cppclass)
>   2: sprintf("C++ object<%s>  of class '%s'<%s>",
> externalptr_address(pointer),     .Call(Class__name, cppclass),
> externalptr_address(cppclass))
>   3: show(modtest)
>   4: show(modtest)
>
> Possible actions:
> 1: abort (with core dump, if enabled)
> 2: normal R exit
> 3: exit R without saving workspace
> 4: exit R saving workspace
> Selection: 1
> aborting ...
> Segmentation fault
>
>
> best,
> Christian
>
>


-- 
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
http://romain-francois.com
|- http://bit.ly/fhqbRC : Rcpp workshop in Chicago on April 28th
|- http://bit.ly/dFyZGB : Hydraulique au Montpellier Comedie Club
`- http://bit.ly/eVXit9 : Eponyme : 40 minutes stand up




More information about the Rcpp-devel mailing list