[ROOT] Obtaining the pointer on function from macros

From: Ruben Shahoian (Ruben.Shahoyan@cern.ch)
Date: Sun Feb 24 2002 - 18:14:30 MET


Hello,
is there any possibility to get the pointer on the function, loaded as
a macro by CINT? 
I need to execute from main program (not a macros!) the user defined
function supplied as a macros (at program compliation time the macros name
is not defined yet. I imagine comething like this:

MyClass {
...
  void Init();
  void UseMacro();

protected:
  void    (*fUserMacro)(Int_t);        // pointer on function from user,
                                       // takes 1 integer argument
  TString  fUserMacroName;             // name of the user macro
...
} 

MyClass::Init()
{
...
   fUserMacro = 0;
   fUserMacroName ++ = "++";    // to call in compiled mode
   gROOT->LoadMacro(fUserMacroName.Data());
   fUserMacro = ?????? GET_POINTER_ON_LOADED_AND_COMPILED_FUNCTION ???     
...
}

MyClass::UseMacro()
{
...
 fUserMacro(val1)
...
 fUserMacro(val2)

... etc

}

If this is not possible, are there any workarounds?

Regards,
	Ruben Shahoyan



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:42 MET