[Rcpp-devel] experimental handling of uncaught exceptions
Romain François
francoisromain at free.fr
Sun Dec 27 18:15:08 CET 2009
Hi,
I've commited some code that aims at forwarding uncaught C++ exceptions
to R.
For example :
require( Rcpp)
funx <- cfunction(signature(), '
throw std::range_error("boom") ;
return R_NilValue ;
', Rcpp=TRUE, verbose=FALSE)
tryCatch( funx(), "C++Error" = function(e){
print( "gotcha" )
} )
print( rnorm(10) )
This is experimental so it will need to be reviewed.
This is based on this page :
http://www.linuxtopia.org/online_books/programming_books/c%2B%2B_practical_programming/c++_practical_programming_023.html
Romain
--
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://tr.im/IlMh : CPP package: exposing C++ objects
|- http://tr.im/HlX9 : new package : bibtex
`- http://tr.im/Gq7i : ohloh
More information about the Rcpp-devel
mailing list