Re: [ROOT] creating global variables in a named macro

From: Patois Yannick (patois@ganil.fr)
Date: Mon Feb 26 2001 - 12:45:49 MET


On Mon, 26 Feb 2001, Dariusz Miskowiec wrote:

> Dear Rootists,
> 
> Is there a way of creating a global variable within a named 
> macro? I know that I can create a histogram in a named macro 
> and then find it in the current directory, but how about other 
> objects? I am thinking about something like

I think that you would have to derivate your object from TNamed, then
you could do a 'new TMyObject("name",...)' anywhere and expect to find
it listed somewhere in the current directory. But I feel it's overkill
for a simple int variable !

To only have it floating somewhere in CINT globals, you just declare it
outside of the function, as Rene said.

If you want to instanciate a new named CINT global each time you enter a
script function, I dont see any way to do it, but there might be a
trick, with CINT. Because there is certainly something like an inside
function 'CreateGlobalVariable(char *name, TType type, void *value)'.
But I found CINT code quite hard to read, so I cant tell you more.

	Yannick



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:37 MET