Re: [ROOT] catching exceptions from compiled code in interpreter

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Thu Nov 21 2002 - 17:57:13 MET


Hi Masa,

  these CINT options have not been enabled for any platform. Are there
any side effects to be expected?

-- FOns


On Thu, 2002-11-21 at 12:54, Masaharu Goto wrote:
> Hello James,
> 
> This is because  ROOT is not compiled with G__STD_EXCEPTION
> and G__EXCEPTION flag in your makefile.
> 
> Fons,
> Are G__STD_EXCEPTION and G__EXCEPTION  defined for most
> of the platforms?  Both of those macros have to be defined in order to
> catch compiled exception.
> 
> Thank you
> Masa Goto
> 
> 
> ----- Original Message -----
> From: "James Peachey" <peachey@bigband.gsfc.nasa.gov>
> To: "Masaharu Goto" <MXJ02154@nifty.ne.jp>
> Cc: "Fons Rademakers" <Fons.Rademakers@cern.ch>
> Sent: Thursday, November 21, 2002 5:44 AM
> Subject: Re: [ROOT] catching exceptions from compiled code in interpreter
> 
> 
> > Hello Masa-san,
> >
> > I am afraid I have a second problem: exceptions thrown from inside
> > compiled code are not caught in interpreted code. This happens both
> > on Linux and Solaris. (On Solaris, I worked around the problem with
> > std::exception by hand, but on Linux, like you I did not see that
> > problem at all.)
> >
> > My example files are attached in a tarball. After you unpack it and
> > build it, you should see the following phenomenon:
> >
> > anu [79] root_exceptions: root
> >   *******************************************
> >   *                                         *
> >   *        W E L C O M E  to  R O O T       *
> >   *                                         *
> >   *   Version   3.03/07    15 August 2002   *
> >   *                                         *
> >   *  You are welcome to visit our Web site  *
> >   *          http://root.cern.ch            *
> >   *                                         *
> >   *******************************************
> >
> > FreeType Engine v1.x used to render TrueType fonts.
> > Compiled for linux with thread support.
> >
> > CINT/ROOT C/C++ Interpreter version 5.15.50, July 7 2002
> > Type ? for help. Commands must be C++ statements.
> > Enclose multiple statements between { }.
> > root [0] .L libr_except.so
> > root [1] .x r_except_test.C
> > anu [80] root_exceptions:
> >
> > The message in root_excep_test.C is not printed;
> > instead the interpreter exits.
> >
> > James
> >
> > On Wed, 20 Nov 2002, James Peachey wrote:
> >
> > > Hello Masa-san,
> > >
> > > Thanks for the quick reply. For myself I would be happy with
> > > turning on namespace std (using -Y). I would definitely like to
> > > try it when Fons sends the instructions. However, the software I
> > > am working on (the INTEGRAL science analysis software developed
> > > at ISDC) is used as a foundation for a lot of other software.
> > > I am concerned that many other scripts will break until people
> > > add "using" statements. Are there any other possibilities
> > > to correct the problem?
> > >
> > > Thanks,
> > > James
> > >
> > > On Tue, 19 Nov 2002, Masaharu Goto wrote:
> > >
> > > > Hello James,
> > > >
> > > > I could not reproduce this problem on my machine(RedHat7.3 Linux)
> > > > But, this error can be compiler dependent at the moment. So, I can
> > > > believe you are actually seeing this problem.
> > > >
> > > > Cint has a option to switch between 'using namespace std' and
> explicitly
> > > > qualifying every object by std::.  Your rootcint is set up as the
> first
> > > > case.
> > > > But you need it to be second.
> > > >
> > > > Fons,
> > > > Could you tell us how to give -Y option(turn on/off std namespace)
> with
> > > > rootcint? It will solve James's problem.
> > > >
> > > > Thank you
> > > > Masa Goto
> > > >
> > > >
> > > > ----- Original Message -----
> > > > From: "James Peachey" <peachey@bigband.gsfc.nasa.gov>
> > > > To: <roottalk@pcroot.cern.ch>
> > > > Sent: Tuesday, November 19, 2002 1:56 AM
> > > > Subject: [ROOT] catching exceptions from compiled code in interpreter
> > > >
> > > >
> > > > > Hello,
> > > > >
> > > > > I'm trying to create a compiled exception class I can catch in the
> > > > > interpreter (SunOS 5.8, WS 6.0, Root 3.03.07). My files contain:
> > > > >
> > > > > + begin
> > > >
> r_exceptLinkDef.h ------------------------------------------------------
> > > > > #ifdef __CINT__
> > > > >
> > > > > #pragma link off all class;
> > > > > #pragma link off all function;
> > > > > #pragma link off all global;
> > > > > #pragma link off all typedef;
> > > > >
> > > > > #pragma link C++ class r_exception;
> > > > >
> > > > > #endif
> > > > > + end
> > > >
> r_exceptLinkDef.h --------------------------------------------------------
> > > > >
> > > > > + begin
> > > >
> r_except.h -------------------------------------------------------------
> > > > > #ifndef R_EXCEPT_H
> > > > > #define R_EXCEPT_H
> > > > >
> > > > > #include <exception>
> > > > > #include "Rtypes.h"
> > > > >
> > > > > class r_exception: public std::exception {
> > > > >   public:
> > > > >     r_exception();
> > > > >   ClassDef(r_exception, 1)
> > > > > };
> > > > > #endif
> > > > > + end
> > > >
> r_except.h ---------------------------------------------------------------
> > > > >
> > > > > Then I execute the following:
> > > > >
> > > > > rootcint -f r_exceptCint.cpp -c r_except.h r_exceptLinkDef.h
> > > > > CC -c -I/data/anu/isdc/root-3.03.07/sparc-sun-solaris2.8/include
> > > > r_exceptCint.cpp
> > > > > "r_exceptCint.cpp", line 326: Error: The name exception is
> ambiguous,
> > > > exception and std::exception.
> > > > > "r_exceptCint.cpp", line 326: Error: The name exception is
> ambiguous,
> > > > exception and std::exception.
> > > > > 2 Error(s) detected.
> > > > > make: *** [r_exceptCint.o] Error 2
> > > > >
> > > > > The offending line of code is in the block:
> > > > >
> > > > >     316 /*********************************************************
> > > > >     317 * Inheritance information setup/
> > > > >     318 *********************************************************/
> > > > >     319 extern "C" void G__cpp_setup_inheritancer_exceptCint() {
> > > > >     320
> > > > >     321    /* Setting up class inheritance */
> > > > >     322
> > > >
> if(0==G__getnumbaseclass(G__get_linked_tagnum(&G__r_exceptCintLN_r_exception
> > > > ))) {
> > > > >     323      r_exception *G__Lderived;
> > > > >     324      G__Lderived=(r_exception*)0x1000;
> > > > >     325      {
> > > > >     326        exception *G__Lpbase=(exception*)G__Lderived;
> > > > >     327
> > > >
> G__inheritance_setup(G__get_linked_tagnum(&G__r_exceptCintLN_r_exception),G_
> > > >
> _get_linked_tagnum(&G__r_exceptCintLN_exception),(long)G__Lpbase-(long)G__Ld
> > > > erived,1,1);
> > > > >     328      }
> > > > >     329    }
> > > > >     330 }
> > > > >
> > > > > After I run the rootcint command, if I change line 326 to use
> > > > > the fully qualified "std::exception" instead of just "exception"
> > > > > then it compiles and runs properly.
> > > > >
> > > > > Is this a problem with root/rootcint or am I doing something wrong?
> > > > >
> > > > > Regards,
> > > > > James
> > > > >
> > > >
> > >
> > >
> > >
> > >
> >
-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7679480



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:20 MET