You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First, thanks for this package! I've longed for a lean R to C++ interface for quite awhile.
It looks like the END_CPP11 macro lacks a catch-all exception handler. I was using a Boost library and wondering why I was getting aborts (it was not using std::exception). Was a catch(...){} block intentionally omitted?
R version 3.6.3 (2020-02-29) -- "Holding the Windsock"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin15.6.0 (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> cpp11::cpp_function('void test() { throw; }')
> test() # abort
libc++abi.dylib: terminating
zsh: abort R
The text was updated successfully, but these errors were encountered:
Just because we hadn't yet encountered code that was issuing exceptions that didn't inherit from std::exception, but we can add this, thanks for opening the issue.
Ok this now should work how you assumed it would. Note I had to tweak your example slightly to throw an integer exception as throw; without any arguments is used to rethrow exceptions (and would skip even the universal try / catch block).
cpp11::cpp_function('void test() { throw 42; }')
test()
#> Error in test(): C++ error (unknown cause)
First, thanks for this package! I've longed for a lean R to C++ interface for quite awhile.
It looks like the END_CPP11 macro lacks a catch-all exception handler. I was using a Boost library and wondering why I was getting aborts (it was not using std::exception). Was a
catch(...){}
block intentionally omitted?On OSX
The text was updated successfully, but these errors were encountered: