[Haskell-cafe] C++ exception (from *.so) catchable by Haskell??

Brandon Allbery allbery.b at gmail.com
Thu Feb 13 22:18:40 UTC 2014

On Thu, Feb 13, 2014 at 3:57 PM, Nick Rudnick <nick.rudnick at gmail.com>wrote:

> std::set_unexpected (myUnexpected);
> try {
>   throw runtime_error("OOOPS...");
> }
> catch (int) { std::cerr << "caught int\n"; }
> catch (...) { std::cerr << "caught some other exception type\n"; }
> still is the problem that the STDERR message of myUnexpected doesn't
> appear – is

You're catching all exceptions so there are no "unexpected" ones to invoke
myUnexpected on.

> there anywhere code applying what you told about?

I'm not sure what you're asking here. My suggestion was essentially to have
something like the try/catch you wrote for testing above wrapped around
whatever C++ code is throwing the exception, and invoke that try/catch via
the FFI.

brandon s allbery kf8nh                               sine nomine associates
allbery.b at gmail.com                                  ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20140213/49593a90/attachment.html>

More information about the Haskell-Cafe mailing list