From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21292 invoked by alias); 15 Oct 2002 08:08:04 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 21285 invoked from network); 15 Oct 2002 08:08:02 -0000 Received: from unknown (HELO mailtwo.networkinference.com) (81.2.73.205) by sources.redhat.com with SMTP; 15 Oct 2002 08:08:02 -0000 Subject: RE: Throw/Catch not working in SO? MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Date: Tue, 15 Oct 2002 02:45:00 -0000 X-MimeOLE: Produced By Microsoft Exchange V6.0.6249.0 Content-Class: urn:content-classes:message Message-ID: <3BE4D3F0FB726240966DEF40418472B502EC04@ni-lon-server1.ad.networkinference.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: From: "Rob" To: Cc: X-SW-Source: 2002-10/txt/msg00790.txt.bz2 This might be a manifestation of a problem involving different versions of = the c++ support library, which includes functions used for internal run-tim= e type identification and exception handling. If your main app is linked ag= ainst one version of the support library and your shared library is linked = against another, then Weird Stuff can happen. Reported manifestations include exceptions not being caught, or SEGVs durin= g the initial throw. The simple solution is to just make sure the app and the lib are linked aga= inst the same version of the library (and, presumably, are built with the s= ame C++ compiler). Unfortunately, not all of us have that luxury. It seems to me that statically linking the support library into the shared = object and then privatizing all the symbols should avoid these kinds of con= flicts (and should prevent C++ ABI fragility, if the shared lib uses only a= C interface), but I have been unable to get this to work. I'm still trying= to figure out just what ld.so is doing to screw things up... Hope this helps. -rob > -----Original Message----- > From: Charles Y. Kim [mailto:ckim@telcontar.com] > Sent: 14 October 2002 23:38 > To: gcc@gcc.gnu.org > Subject: Throw/Catch not working in SO? >=20 >=20 > Hi all, >=20 > I'm using some exception handling in a shared object, and while the > throw()/catch() works in both Windows and FreeBSD (using GCC=20 > 2.96), in Linux > (GCC 3.02 --enable-shared --enable-threads=3Dposix) the throw=20 > is executed, and > the catch never happens. >=20 > For example... let's say I have the following code in the=20 > shared object... >=20 > void error() { > throw(1); > } >=20 > void error2() { > error(); > } >=20 > void function() { > try { > if (blah) > error2(); > } > catch(...) { > printf("exception caught"); > } > } >=20 > I know that error2() is being called and the exception is=20 > being thrown... > but it's not being caught at all. >=20 > Does anyone have ANY ideas? >=20 > Thanks. >=20 > - Charles >=20 >=20 >=20