[Rcpp-devel] self documentation and signature extract for functions

Romain Francois romain at r-enthusiasts.com
Tue Nov 23 15:14:58 CET 2010


Hello,

Following yesterday's commits, I've added functionality to add 
documentation and grab the signature for C++ functions exposed in modules :

require( inline )
require( Rcpp )


fx <- cxxfunction(, "", includes =
'using namespace Rcpp ;
	
double norm( double x, double y ){
	return sqrt( x*x + y*y ) ;
}
void foo(double x){
     Rprintf( "blabla %5.3f\\n", x ) ;
}

RCPP_MODULE(mod){
	function( "norm", &norm, "bla bla nla" ) ;
	function( "foo", &foo ) ;
}
', plugin = "Rcpp" )

mod <- Module( "mod", getDynLib(fx) )

 > mod$norm
internal C++ function <0x100530de0>
     docstring : bla bla nla
     signature : double norm(double, double)

 > mod$foo
internal C++ function <0x1005352b0>
     signature : void foo(double)

Romain

-- 
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://bit.ly/9VOd3l : ZAT! 2010
|- http://bit.ly/c6DzuX : Impressionnism with R
`- http://bit.ly/czHPM7 : Rcpp Google tech talk on youtube




More information about the Rcpp-devel mailing list