On Tue, Sep 22, 2009 at 7:27 PM, Phil Thompson <span dir="ltr">&lt;<a href="mailto:phil@riverbankcomputing.com" target="_blank">phil@riverbankcomputing.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

On Tue, 22 Sep 2009 19:17:12 +0200, Arve Knudsen &lt;<a href="mailto:arve.knudsen@gmail.com" target="_blank">arve.knudsen@gmail.com</a>&gt;<br>
<div><div>wrote:<br>
&gt; On Tue, Sep 22, 2009 at 6:28 PM, Phil Thompson<br>
&gt; &lt;<a href="mailto:phil@riverbankcomputing.com" target="_blank">phil@riverbankcomputing.com</a>&gt;wrote:<br>
&gt;<br>
&gt;&gt; On Mon, 21 Sep 2009 18:40:35 +0200, Arve Knudsen<br>
&lt;<a href="mailto:arve.knudsen@gmail.com" target="_blank">arve.knudsen@gmail.com</a>&gt;<br>
&gt;&gt; wrote:<br>
&gt;&gt; &gt; Hi<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; I have run into this problem where a C++ exception is not correctly<br>
&gt;&gt; &gt; translated into Python on Linux (it works under VC++ on Windows). The<br>
&gt;&gt; &gt; exception is apparently not caught as it should, but looking at the<br>
&gt;&gt; &gt; SIP-generated sourcecode I cannot see why (there is a try/catch block<br>
&gt;&gt; &gt; for<br>
&gt;&gt; &gt; the exception). Any ideas as to what might be going wrong here? I have<br>
&gt;&gt; &gt; tried<br>
&gt;&gt; &gt; std::exception instead of my custom exception, and this gets<br>
translated<br>
&gt;&gt; &gt; correctly to Python.<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; Attached I have a simple library &#39;raiser&#39;, which is wrapped by the<br>
&gt;&gt; &gt; Python<br>
&gt;&gt; &gt; module &#39;raiser&#39;. In order to build it, first build a shared library<br>
&gt;&gt; &gt; from<br>
&gt;&gt; &gt; &#39;raiser.cpp&#39;, then run &#39;configure.py&#39; and make.<br>
&gt;&gt;<br>
&gt;&gt; Works fine for me on Linux with the current SIP snapshot. I did change<br>
&gt;&gt; your<br>
&gt;&gt; code first to make everything in-line so it wasn&#39;t necessary to build a<br>
&gt;&gt; separate library.<br>
&gt;<br>
&gt;<br>
&gt; By inlining you remove the problem of interest, which is to propagate an<br>
&gt; exception from one library to another. It also works for me when<br>
inlining,<br>
&gt; so try my original version please.<br>
<br>
</div></div>That implies it&#39;s a build system issue. Can you send me the Makefile you<br>
are using to build the library so that I know I&#39;m exactly reproducing what<br> you are doing.</blockquote><div><br></div><div>For this particular case, you can do the simplest thing possible: g++ -shared -o libraiser.so raiser.cpp.</div>
<div><br></div><div>Arve </div>