<div dir="ltr">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?<div><br></div><div>
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?</div>
<div><br></div><div>Cheers, Nick</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-02-13 13:11 GMT+01:00 Alexander Kjeldaas <span dir="ltr"><<a href="mailto:alexander.kjeldaas@gmail.com" target="_blank">alexander.kjeldaas@gmail.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><br>Two approaches:<br><br>1. Use set_unexpected.<br><a href="http://www.cplusplus.com/reference/exception/set_unexpected/" target="_blank">http://www.cplusplus.com/reference/exception/set_unexpected/</a><br>
<br></div>

2. Wrap your FFI code in try/catch.<br><br>Alexander<br></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div class="h5">On Thu, Feb 13, 2014 at 12:43 PM, Nick Rudnick <span dir="ltr"><<a href="mailto:nick.rudnick@gmail.com" target="_blank">nick.rudnick@gmail.com</a>></span> wrote:<br>


</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr">Dear all,<div><br></div><div>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?</div>



<div><br></div><div>Generally, it is the following:</div><div>1) Injecting code that throws a an exception in C++ library code, e.g.,</div><div><br></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px">



<div><font face="courier new, monospace">throw runtime_error("OOOPS...");</font></div></blockquote><div><br></div><div>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).</div>



<div><br></div><div>3) To my surprise, every time the output stays the same:</div><div><br></div><div><div><font face="courier new, monospace">terminate called after throwing an instance of 'std::runtime_error'</font></div>



<div><font face="courier new, monospace">  what():  </font><span style="font-family:'courier new',monospace">OOOPS...</span></div></div><div><br></div><div>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?</div>



<div><br></div><div>Any comment welcome, cheers, Nick</div></div>
<br></div></div>_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org" target="_blank">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div>