Hi Phil<br><br>On Wed, Sep 23, 2009 at 9:43 PM, Phil Thompson <span dir="ltr"><<a href="mailto:phil@riverbankcomputing.com">phil@riverbankcomputing.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Tue, 22 Sep 2009 20:28:09 +0200, Arve Knudsen <<a href="mailto:arve.knudsen@gmail.com">arve.knudsen@gmail.com</a>><br>
<div><div></div><div class="h5">wrote:<br>
> On Tue, Sep 22, 2009 at 7:27 PM, Phil Thompson<br>
> <<a href="mailto:phil@riverbankcomputing.com">phil@riverbankcomputing.com</a>>wrote:<br>
><br>
>> On Tue, 22 Sep 2009 19:17:12 +0200, Arve Knudsen<br>
<<a href="mailto:arve.knudsen@gmail.com">arve.knudsen@gmail.com</a>><br>
>> wrote:<br>
>> > On Tue, Sep 22, 2009 at 6:28 PM, Phil Thompson<br>
>> > <<a href="mailto:phil@riverbankcomputing.com">phil@riverbankcomputing.com</a>>wrote:<br>
>> ><br>
>> >> On Mon, 21 Sep 2009 18:40:35 +0200, Arve Knudsen<br>
>> <<a href="mailto:arve.knudsen@gmail.com">arve.knudsen@gmail.com</a>><br>
>> >> wrote:<br>
>> >> > Hi<br>
>> >> ><br>
>> >> > I have run into this problem where a C++ exception is not correctly<br>
>> >> > translated into Python on Linux (it works under VC++ on Windows).<br>
>> >> > The<br>
>> >> > exception is apparently not caught as it should, but looking at the<br>
>> >> > SIP-generated sourcecode I cannot see why (there is a try/catch<br>
>> >> > block<br>
>> >> > for<br>
>> >> > the exception). Any ideas as to what might be going wrong here? I<br>
>> >> > have<br>
>> >> > tried<br>
>> >> > std::exception instead of my custom exception, and this gets<br>
>> translated<br>
>> >> > correctly to Python.<br>
>> >> ><br>
>> >> > Attached I have a simple library 'raiser', which is wrapped by the<br>
>> >> > Python<br>
>> >> > module 'raiser'. In order to build it, first build a shared library<br>
>> >> > from<br>
>> >> > 'raiser.cpp', then run 'configure.py' and make.<br>
>> >><br>
>> >> Works fine for me on Linux with the current SIP snapshot. I did<br>
change<br>
>> >> your<br>
>> >> code first to make everything in-line so it wasn't necessary to build<br>
>> >> a<br>
>> >> separate library.<br>
>> ><br>
>> ><br>
>> > By inlining you remove the problem of interest, which is to propagate<br>
>> > an<br>
>> > exception from one library to another. It also works for me when<br>
>> inlining,<br>
>> > so try my original version please.<br>
>><br>
>> That implies it's a build system issue. Can you send me the Makefile you<br>
>> are using to build the library so that I know I'm exactly reproducing<br>
>> what<br>
>> you are doing.<br>
><br>
><br>
> For this particular case, you can do the simplest thing possible: g++<br>
> -shared -o libraiser.so raiser.cpp.<br>
<br>
</div></div>And add -fPIC presumably.<br></blockquote><div><br>I forgot about that actually, apparently it made no difference :) <br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
You need to add "export_all=True" when creating the Makefile in your<br>
configure.py.<font color="#888888"><br></font></blockquote><div><br>Thanks, this worked for my simple case. However, it does not help in our real project (although the exceptions' corresponding symbols in the binaries now seem more consistent with the throwing module), so I'm guessing that the issue is with different build parameters for our C++ and Python subsystems. The C++ part of our project is built with QMake, is there any standard way of passing parameters from a QMake setup to the SIP configuration system, so that they are consistent?<br>
<br>Thanks!<br>Arve<br></div></div><br>