Re: [ROOT] global data in macro files

From: Rene Brun (Rene.Brun@cern.ch)
Date: Wed Jun 14 2000 - 18:05:51 MEST


Hi Marc,
Remove the statement 
  gROOT->Reset();
from your function sqark. This deletes all the global symbols defined
up to this point. !!
 gROOT->Reset() is a useful instruction only in unnamed macros to cleanup
the global definitions in case one executes this macro several times.

Rene Brun

kamps wrote:
> 
> There's probably a good reason on page 1 of the introduction that tells me
> this is wrong :
> 
> ---------------------------------------------------
> 
> const size_t BIG = 1000;
> 
> void sqark()
> {
> 
>         printf("Finding the squashing function\n");
> 
>         gROOT->Reset();
>         c1 = new TCanvas("c1","Canvas squash",200,10,600,480);
>         TPad pad1("Large view","pad1",0.05,0.52,0.95,0.97);
>         TPad pad2("Small view","pad2",0.05,0.02,0.95,0.47);
> 
>         pad1.Draw();
>         pad2.Draw();
> 
>         char buffer[BIG];
> }
> 
> ---------------------------------------------------
> but I don't see it. It is in a file sqark.C. The error message is:
> #### error message #######
> Non-static-const variable in array dimention FILE:D:\ROOT\macros\sqark.C
> LINE:20
> (cint allows this only in interactive command and special form macro which
> is special extension. It is not allowed in source code.
> #### end of errormessage ######
> 
> OK. Changing the definition to static const size_t BIG doesn't help though.
> And if I have to use
> a special extension, I'd like to know which one. I have gone through the
> most basic CINT documentation but could not find an obvious hint to this
> problem.
> 
> I could change this style of coding easily, but later on I have to use a
> float(*func) (float)
> in 3rd party software. I can only pass a parameter to this function via
> global data, this is
> also giving me trouble. Are there general guidelines for declaring global
> variables or arrays
> in macro's ?
> 
> Running ROOT on WinNt 4.0
> 
> Marc



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:27 MET