[Rcpp-devel] experimental handling of uncaught exceptions
Dirk Eddelbuettel
edd at debian.org
Sun Dec 27 21:03:42 CET 2009
On 27 December 2009 at 13:36, Dirk Eddelbuettel wrote:
| On 27 December 2009 at 18:15, Romain François wrote:
| | 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) )
|
| That's pretty crazy cool -- I'll have to try that.
Can we get access to the string 'boom' at the R level? That's how the
existing C++-based try/catch -> Rf_error() works.
Also, the onAttach trick won't work for other packages just including Rcpp.h
et al and linking to libRcpp.{so,a}.
Dirk
--
Three out of two people have difficulties with fractions.
More information about the Rcpp-devel
mailing list