[Rcpp-commits] r1050 - pkg/Rcpp/man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Apr 15 12:00:10 CEST 2010


Author: romain
Date: 2010-04-15 12:00:10 +0200 (Thu, 15 Apr 2010)
New Revision: 1050

Added:
   pkg/Rcpp/man/dotcpp.Rd
Log:
documentation for .Cpp

Added: pkg/Rcpp/man/dotcpp.Rd
===================================================================
--- pkg/Rcpp/man/dotcpp.Rd	                        (rev 0)
+++ pkg/Rcpp/man/dotcpp.Rd	2010-04-15 10:00:10 UTC (rev 1050)
@@ -0,0 +1,44 @@
+\name{.Cpp}
+\alias{.Cpp}
+\title{C++ foreign function interface}
+\description{
+Function to make calls to compiled code that been loaded into R. 
+
+\code{.Cpp} is a modified version of \link{.Call} that handles
+c++ exceptions and forwards them to R as R conditions. 
+}
+\usage{
+.Cpp(name, \dots, PACKAGE)
+}
+\arguments{
+  \item{name}{A character string giving the name of the C routine, or an object of class
+    \code{"\link{NativeSymbolInfo}"}, \code{"\link{RegisteredNativeSymbol}"}
+    or \code{"\link{NativeSymbol}"} referring to such a name.}
+  \item{\dots}{arguments to be passed to the foreign function.}
+  \item{PACKAGE}{Passed to \link{getNativeSymbolInfo}, See also \link{.Call} for details.}
+}
+\value{
+result of the function or condition is an C++ exception is thrown
+}
+\details{
+	\code{.Cpp} only handles routines that \link{.Call} can handle
+}
+\examples{
+\dontrun{
+# identical
+.Cpp( "capabilities", PACKAGE = "Rcpp" )
+.Call( "capabilities", PACKAGE = "Rcpp" )
+
+# here testfun_ex_2 throws a c++ exception
+# which .Call cannot handle, but .Cpp can
+tryCatch( 
+	.Cpp( "testfun_ex_2", 1, 2, PACKAGE = "Rcpp"), 
+	"std::range_error" = function(e){
+		# handle the message of the c++ exception
+		print( conditionMessage(e) )
+		
+		print( str( e ) )
+	} ) 
+}     
+}
+\keyword{programming}



More information about the Rcpp-commits mailing list