Works for me:
R> require(Rcpp)
R> require(inline)
Loading required package: inline
R> inc <- '
+ using namespace Rcpp;
+ double norm( double x, double y ) {
+ return sqrt( x*x + y*y );
+ }
+ RCPP_MODULE(mod) {
+ function( "norm", &norm );
+ }
+ '
R> fx <- cxxfunction(signature(), plugin="Rcpp", include=inc)
R>
R> mod <- Module( "mod", getDynLib(fx) )
R>
R> mod$norm( 3, 4 )
[1] 5
R>
R> sessionInfo()
R version 2.15.2 (2012-10-26)
Platform: x86_64-pc-linux-gnu (64-bit)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8
LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8
[6] LC_MESSAGES=en_US.UTF-8 LC_PAPER=C LC_NAME=C
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] inline_0.3.10 RQuantLib_0.3.9 Rcpp_0.10.1.5
loaded via a namespace (and not attached):
[1] compiler_2.15.2 tools_2.15.2
R>
That is with Rcpp from SVN but that shouldn't matter.
Dirk
--
Dirk Eddelbuettel | [email protected] | http://dirk.eddelbuettel.com
_______________________________________________
Rcpp-devel mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel