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

From: Masaharu Goto (MXJ02154@nifty.ne.jp)
Date: Tue Nov 19 2002 - 13:06:23 MET


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
>



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