thank you :-) in regard of (1), I am still fiddling to get it running; as Brandon did foresee, there seem difficulties here. Do have any piece of FFI code in mind which makes use of this?

With respect to (2) – if one has a rather fine grained interface to rather atomic actions, remains the overhead still OK at lots of function calls? I read overhead should be quite low, but does it apply for FFI usage?

Cheers, Nick


2014-02-13 13:11 GMT+01:00 Alexander Kjeldaas <alexander.kjeldaas@gmail.com>:

Two approaches:

1. Use set_unexpected.
http://www.cplusplus.com/reference/exception/set_unexpected/

2. Wrap your FFI code in try/catch.

Alexander


On Thu, Feb 13, 2014 at 12:43 PM, Nick Rudnick <nick.rudnick@gmail.com> wrote:
Dear all,

after trying around a while this seems to be a good question for Haskell-cafe to me: Is somewhere a place (e.g. some Hackage package) where intercepting exceptions from C++ library code is done, so one can look *how* it is done?

Generally, it is the following:
1) Injecting code that throws a an exception in C++ library code, e.g.,

throw runtime_error("OOOPS...");

2) then, I tried out everything in reach (Haskell docs, Hackage interfaces to C++ considered to be well-done) to get it caught (try, catch, bracket, finally; various exception types; forkOS).

3) To my surprise, every time the output stays the same:

terminate called after throwing an instance of 'std::runtime_error'
  what():  OOOPS...

Is it possible at all to get a grip of this? Is there some place where it is done? Does the terminate call already happen with the C++ execution?

Any comment welcome, cheers, Nick

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe