Dear fellow Monks,

After doing a supersearch, a scan of all relevant docs and a grep on the .xs files of all the modules I've installed on my machine I didn't get a clue, so I'd like to seek your collective wisdom.

I'm currently writing a Perl module that interfaces to a C++ library. In several functions of this library, exceptions are thrown of a type I know, so in the XS code I use

try { ... } catch{MyException& e) { ... } catch(...) { ... }
to deal with it and to wrap the error message into a croak(...) for Perl consumption.

Upon testing it seems as if the C++ code throws the expected exception alright (this has been verified by the author of the C++ code), but in the XS code I can't catch that exception. However, something gets caught in the generic catch catch(...). I have turned on exception handling with the compiler option -GX.

Hence my question: has anyone successfully caught typed C++ exceptions in XS in this setup (NT 4.0 SP 5, ActiveState Perl 5.6.1 build 633, MSVC++ 6.0) or is there some advice you could offer?

Thanks in advance, -gjb-


In reply to XS & exception handling by gjb

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.