OK, I think I got it. After restarting with a clean workspace, the
message changed to
> yada
Uninitialized module named "yada" from package "testmod",
which is probably due to some kind of lazy loading. I can then directly call
> yada$foo(2,3)
[1] 6
> yada
Rcpp module 'yada'
6 functions:
bar : 1 arguments
bla : 0 arguments
bla1 : 1 arguments
bla2 : 2 arguments
foo : 2 arguments
hello : 0 arguments
1 classes :
World
My mistake was to use the line
> yada <- Module( "yada" )
After this line, the command
> yada$foo(2,3)
leads to the "Failed to initialize module pointer" error.
Is there a way to load/initialize the module in such a way that
> library(testmod)
> yada
immediately yields the full description above?
Best regards,
Peter
Am 09.04.2011 14:11, schrieb [email protected]:
Hello,
I would like to use the very nice Rcpp (0.9.3) Module feature to expose
C++ functions to R. As a starting point, I tried to get the "testmod"
package, created with
Rcpp.package.skeleton( "testmod", module = TRUE )
to run. I can compile and install the package without errors on R
2.14.0, Suse Linux 11.3. However, when I try to use the module, I get
the following output:
require(Rcpp)
Lade nötiges Paket: Rcpp
library(testmod)
Attaching package: ‘testmod’
The following object(s) are masked _by_ ‘.GlobalEnv’: yada
yada
Uninitialized module named "yada" from package ".GlobalEnv"
yada <- Module( "yada" )
yada$foo( 1,2 )
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 .GlobalEnv
I have seen the previous thread on a similar error, and I suppose the
error is related to Section 3 of the Rcpp-modules vignette. The
.onLoad() routine, however, is already present in the testmod package. I
have also tried to replace the contents of zzz.R with the code given in
Section 3.1.1 of the vignette (using populate()), with the same result.
What do the error messages above actually mean and what am I missing here?
Best regards,
Peter
_______________________________________________
Rcpp-devel mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
_______________________________________________
Rcpp-devel mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel