[Rcpp-devel] Rcpp Module Errors

Jonas Rauch jonas.rauch at googlemail.com
Wed Jun 22 06:37:59 CEST 2011


I had the same problem before I realized that when a Module is loaded as
part of a package (instead of manually loading the shared lib) you don't
need the whole
> Module('yada','test')$ ...
just try
>bla()

The exposed classes and functions are automatically made available in the
namespace of the package

> library(test)
Loading required package: Rcpp
> test::
test::bar               test::bla2              test::rcpp_hello_world
test::bla               test::foo               test::World
test::bla1              test::hello

Regards,
Jonas




On Wed, Jun 22, 2011 at 12:51 AM, Andrew Redd <amredd at gmail.com> wrote:

> I apologize if this has been covered.  I've looked and see a couple of post
> relating to this issue, but I'm not sure if it was ever solved. The example
> modules appear to not work, at least for me.  On a related note I can't get
> my modules to run either, but If I can figure out how to run the examples I
> think I can get mine running.
>
> R> sessionInfo()
> R version 2.13.0 (2011-04-13)
> Platform: x86_64-pc-linux-gnu (64-bit)
>
> locale:
>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
>  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
>  [5] LC_MONETARY=C              LC_MESSAGES=en_US.UTF-8
>  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
>  [9] LC_ADDRESS=C               LC_TELEPHONE=C
> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> other attached packages:
> [1] Rcpp_0.9.4
>
> To install the package skeleton:
> $ r -lRcpp -e"Rcpp.package.skeleton(\"test\",module=T)"
> Attaching package: 'utils'
>
> The following object(s) are masked from 'package:Rcpp':
>
>     .DollarNames, prompt
>
> Creating directories ...
> Creating DESCRIPTION ...
> Creating NAMESPACE ...
> Creating Read-and-delete-me ...
> Saving functions and data ...
> Making help files ...
> Done.
> Further steps are described in './test/Read-and-delete-me'.
>
> Adding Rcpp settings
>  >> added RcppModules: yada
>  >> added Depends: Rcpp
>  >> added LinkingTo: Rcpp
>  >> added useDynLib directive to NAMESPACE
>  >> added Makevars file with Rcpp settings
>  >> added Makevars.win file with Rcpp settings
>  >> added example header file using Rcpp classes
>  >> added example src file using Rcpp classes
>  >> added example R file calling the C++ example
>  >> added Rd file for rcpp_hello_world
>  >> copied the example module
>
> build
> $ R CMD build test
> <<output omitted>>
>
> and check with an error.
> $R CMD check test_1.0.tar.gz
> <<output omitted>>
> * checking whether the name space can be loaded with stated dependencies
> ... WARNING
> Error: .onLoad failed in loadNamespace() for 'test', details:
>   call: value[[3L]](cond)
>   error: failed to load module yada from package test
> Execution halted
>
> <<output omitted>>
>
> According to Dirk's June 15th post on the issue I include require("methods",
> character=TRUE, quietly=TRUE) in the .onLoad function, now checks ok but
> when trying things out I get a segmentation fault.
> $ R -q --vanilla
> R> library(test)
> Loading required package: Rcpp
> R> Module('yada','test')$bla()
>
>  *** caught segfault ***
> address 0x90, cause 'memory not mapped'
>
> Traceback:
>  1: .Call(symbol)
>  2: Module(module, mustStart = TRUE)
>  3: .getModulePointer(x)
>  4: Module("yada", "test")$bla
>
> 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:
>
> So questions are:
>     1) is anyone else getting this error?
>     2) does anyone know how to fix it?
>
> Thanks,
> Andrew
>
>
> _______________________________________________
> Rcpp-devel mailing list
> Rcpp-devel at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20110622/ee208ba4/attachment.htm>


More information about the Rcpp-devel mailing list