[Rcpp-devel] Rcpp.package.skeleton testmod

Romain Francois romain at r-enthusiasts.com
Mon Jun 3 19:43:51 CEST 2013


This might be a documentation issue on our side, but you don't need to 
call Module. The code that is generated loads the module directly when 
teh package is loaded:

 > require( testmod )
Le chargement a nécessité le package : testmod
Le chargement a nécessité le package : Rcpp
 > hello()
Erreur : boom
# this is expected, the hello function is supposed to
# throw an error

# something using a class:
 > new( World )$greet()
[1] "hello"

Just see module as an implementation detail and a way to get access to 
these functions.

Look at the code that is generated in the R and src directories for more 
detail.

Romain

Le 03/06/13 19:31, Andreas Prescher a écrit :
> Hello,
>
> Any help would be greatly
> appreciated!!!!
>
> I am trying to use the example
> testmod  package by using:
>
> Rcpp.package.skeleton( "testmod", module = TRUE )
> and:
> R CMD INSTALL testmod
>
> system information:
> R version 3.0.1 (2013-05-16)
> Platform: x86_64-pc-linux-gnu (64-bit),
> ubuntu 12.04 LTS
> /usr/local/lib/R/site-library/testmod/libs/testmod.so
> Rccp 0.10.3 (build from source with  as also RUnit, inline, rbenchmark)
>
> What I've tried so far amongst other suggestions
> found on the web:
>
> Test 1:
>  > require(Rcpp)
> Lade nötiges Paket: Rcpp
>  > yada <- Module( "yada", "testmod" )
>  > yada$hello()
> Fehler in Module(module, mustStart = TRUE) :
>    Failed to initialize module pointer: Error in
> FUN("_rcpp_module_boot_yada"[[1L]], ...): no such symbol
> _rcpp_module_boot_yada in package testmod
>
> Test 2:
>  > require("testmod")
> Lade nötiges Paket: testmod
> Lade nötiges Paket: Rcpp
>  > yada$hello()
> Fehler: Objekt 'yada' nicht gefunden
>
> Test 3:
>  > library(Rcpp)
>  > library(testmod)
>  > yada <- Module( "yada", "testmod" )
>  > yada$hello()
>
>   *** caught segfault ***
> address 0xd8, cause 'memory not mapped'
>
> Traceback:
>   1: .Call(symbol)
>   2: Module(module, mustStart = TRUE)
>   3: .getModulePointer(x)
>   4: yada$hello
>
> Any help would be
> great, because I want to
> use my existing C++ classes
> in a R package and it
> would be great to have a starting
> point.
>
> Best regards,
>
> Andreas


-- 
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30

R Graph Gallery: http://gallery.r-enthusiasts.com

blog:            http://blog.r-enthusiasts.com
|- http://bit.ly/Zs97qg  : highlight 0.4.1
`- http://bit.ly/10X94UM : Mobile version of the graph gallery



More information about the Rcpp-devel mailing list