> if I do a #include <time.h> then everything seems to work. On the other
> hand, if I compile and include some private code which uses time.h, I
> get :
>
> root [0] time_t tt
> root [1] tt = time(NULL)
> (long)897398755
> root [2] gmtime(&tt)
> Error: class,struct,union or type tm not defined FILE:/tmp/caaaariea
> LINE:1
>
> *** Break *** segmentation violation
>
> My code seems to interfere with time.h since the behaviour is the same
> if I include it or not. What rootcint does for C functions is not quite
> clear to me, as what headers it uses.
> I know, I know, I should use the TTime class. I checked this for
> compatibility with our existing software, to let users switch as
> smoothly as possible from C to C++/ROOT framework.
>
> So, the question is : is time.h included in root from the beginning, as
> are, for example stdio.h ?
time.h is not included by default. You need to do so explicitly, or you can
do so in rootlogon.C by gSystem->Load("time.h") or G__loadfile("time.h").
Another thing, time_t , pdiff_t , fpos_t and other types defined in ANSI C
are platform dependent. This platform dependency is dealt by compiling and
running include/mkincld.c. This is included in cint source package. This
program resolves platform dependency.
It looks like ROOT simply copies include files from certain platform.
This is not quite right. Rene and Fons, will you modify ROOT compilation
prodecure so that cint/include/mkincld.c is executed to create appropreate
header files for each platform.
Masaharu Goto