[ROOT] Re: RE:CINT: exceptions on Linux?

From: Christoph Bugel (cbugel@netvision.net.il)
Date: Sat Aug 11 2001 - 18:56:11 MEST


I found the solution :-))

If I compile the *.c files with gcc -fexception, it works just fine!  this
switch tells gcc to add support for exceptions. This is needed in case a
program mixes C and C++ objects files, and if exceptions are used.

So I changed the CC definition in my platform/linux* file to this:
CC = gcc -fexceptions -Wall
and now it works as expected (no more Abort, core dumped :)

I guess this was not detected before because nobody tried to catch
exceptions from 'around' cint (i.e. in the main function)

I think it would be a good idea to add this compiler flag to the platform files
(the linux ones, probably everything that uses gcc). Or we could use g++
instead of gcc but I'm not sure if that's a good idea.

Thanks,
Christoph



On Fri 2001-08-10, Christoph Bugel wrote:
> ----- Forwarded message from Masaharu Goto <MXJ02154@nifty.ne.jp> -----
> 
> Subject: RE:CINT: exceptions on Linux?
> From: Masaharu Goto <MXJ02154@nifty.ne.jp>
> Date: Fri, 10 Aug 2001 20:40:30 +0900
> To: chris@uxsrvc.tti-telecom.com
> Cc: roottalk@pcroot.cern.ch, rootdev@pcroot.cern.ch
> 
> Hello Chris,
> 
> Cint's exception handling works as follows.
> 
> 1. Compile switches
>   There are 2 compile time switch to turn on/off cint's
>   exception handling. 
> 
>     G__EXCEPTIONWRAPPER
>        Cint handles compiled exception only if this macro
>       is defined. Otherwise, thrown exception will pass through
>       upper level. All the compiled exceptions are caught by
>       catch(...). 
> 
>     G__STD_EXCEPTION
>        If this macro is defined, exception class or a class object
>       derived from exception class is caught by Cint exception
>       wrapper function in Api.cxx.
>        G__EXCEPTIONWRAPPER is automatically defined if G__STD_EXCEPTION
>       is defined.
> 
> I recommend you to look into Api.cxx , G__ExceptionWrapper() and
> newlink.c, G__call_cppfunc(). 
> 
> 
> Thank you
> Masaharu Goto
> 
> 
> >Date: Thu, 9 Aug 2001 19:56:23 +0300
> >From: Christoph Bugel <chris@tti-telecom.com>
> >To: roottalk@pcroot.cern.ch, rootdev@pcroot.cern.ch
> >Subject: CINT: exceptions on Linux?
> >
> >Hi,
> >
> >I am having some problems throwing exceptions from my compiled objects and
> >catching them, outside cint, in my compiled main(). (Abort, core dumped).
> >Before I start digging into this I just wanted to ask if there are any known
> >issues with this on Linux? I think I simply did something wrong myself, but
> >asking never hurts.  (and I don't have this problem on solaris and on 
> windows.)
> >
> >BTW, On windows, G__STD_EXCEPTION is defined, by default, by the following 
> code
> >in G__ci.h, so I had to uncomment the #define line, otherwise I could not 
> catch
> >exceptions by myself, cint would catch them before I could.
> >
> >#if defined(G__WIN32) && !defined(G__STD_EXCEPTION)
> >#define G__STD_EXCEPTION  // I commented this line out!
> >
> >Thanks,
> >Christoph
> 
> ----- End forwarded message -----



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:57 MET