[Rcpp-devel] Rcpp::stop crashes RGui and RStudio under Windows

Romain Francois romain at r-enthusiasts.com
Fri Nov 30 17:41:04 CET 2012


Le 30/11/12 17:32, Steve Lianoglou a écrit :
> Hi,
>
> Quick Q:
>
> On Fri, Nov 30, 2012 at 10:20 AM, JJ Allaire <jj.allaire at gmail.com> wrote:
> [snip]
>> So, we need to investigate how we can prevent exceptions from ever crossing
>> DLL boundaries. In the meantime you can use the explicit exception handling
>> code that Dirk posted, but of course we are very keen to not have to require
>> this boilerplate code on Windows. More later....
>
> It's been a while since I had to go back and dig into my Rcpp code
> (hey, it's just working atm ;-), but can't Dirk's example:
>
> // [[Rcpp::export]]
> int throwCpp(int nb) {
>    try {
>      if (nb == 10)
>        Rcpp::stop("Unexpected condition occurred");
>      return nb*2; // Just for testing the normal case }
>    } catch( std::exception &ex ) {
>      forward_exception_to_r( ex );
>    } catch(...) {
>      ::Rf_error( "c++ exception (unknown reason)" );
>    }
>    return -1; // -Wall
> }
>
> still be written like so?

Sure. But trying to have Dirk write something upper case is a struggle.

> // [[Rcpp::export]]
> int throwCpp(int nb) {
> BEGIN_RCPP
>    if (nb == 10)
>      Rcpp::stop("Unexpected condition occurred");
>    return nb*2; // Just for testing the normal case }
> END_RCPP
> }
>
> ?
>
> Not so terrible -- especially if you have some Rcpp snippets set up in
> your editor of choice, no?
>
> -steve

We are discussing ways around this issue.

I think we can do something that would work on windows and not require 
us writing boiler plate stuff.

Romain

-- 
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30

R Graph Gallery: http://gallery.r-enthusiasts.com
`- http://bit.ly/SweN1Z : SuperStorm Sandy

blog:            http://romainfrancois.blog.free.fr
|- http://bit.ly/RE6sYH : OOP with Rcpp modules
`- http://bit.ly/Thw7IK : Rcpp modules more flexible



More information about the Rcpp-devel mailing list