[ROOT] catching exceptions from compiled code in interpreter

From: James Peachey (peachey@bigband.gsfc.nasa.gov)
Date: Mon Nov 18 2002 - 17:56:52 MET


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__Lderived,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