As you point out, <string> header file used by rootcint and by the compiler
are different. This causes problem when you compile dictionary.
g++ tries to compile dictionary generated by different header file.
There is no clean solution to this right now. I use a version from Modena
Software in rootcint and cint. While other people are implementing more
ANSI/ISO compilant version. Many of these are still evolving.
Please return 'char*' from MyMethod.
Masaharu Goto
>I have a method in one of my classes that returns a string. While it seems
>I can use string in the interpreter by following Masa's instructions
>(include the folder STL in the cint/ directory...), when I try to
>initialize a string declared in root by
>
>root[0] #include <string>
>root[0] string b = myclass.mymethod(....)
>
>it segfaults. When I try to send a string as an argument to another member
>function, it segfaults too.
>
>I know that stl is very far from being fully usable in CINT but I thought
>that at least vector and string where usable.
>
>Does it have something to do with the fact that the include file
><string> used by rootcint and the one used by the compiler are not the
>same ? (I use g++ on ALPHA, the behaviour is the same on MkLinux)
>
>Here is the definition of the class :
TWSeries.h ----------------------------------------------------
#include <string>
class TWSeries {
protected:
string fName;
public:
TWSeries();
TWSeries(const string name);
virtual ~TWSeries();
string MyMethod();
};
-----------------------------------------------------------------
>
>rootcint -f G_TWSeries.cxx -c TWSeries.h LinkDef.h
>
>g++ -fPIC -I/usr/X11R6.1/include/ -O2 -I/root/root/include -c G_TWSeries.cxx
>
>I get :
>
>G_TWSeries.cxx: In function `int G__TWSeries_MyMethod_3_0(struct G__value
>*,char *, struct G__param *, int)':
>G_TWSeries.cxx:46: Internal compiler error 124.
>G_TWSeries.cxx:46: Please submit a full bug report to
>`bug-g++@prep.ai.mit.edu'.