[ROOT] CINT: access to variables of a compiled program?

From: Daniel Barna (Daniel.Barna@cern.ch)
Date: Sun Oct 22 2000 - 00:41:53 MEST


Hi Rooters,
It is easily possible to run macros from within a compiled program. 
But is it also possible, that these macros have access to the variables of
the program, and therefore they can modify them? 
A very unelegant solution to modify an integer variable of the program
from a macro is the following:

int i=4;
char cmd[100];
sprintf(cmd,"int *i_p = (int *)0x%x;",&i);
gInterpreter->ProcessLine(cmd);
gInterpreter->ExecuteMacro("macro.C");
cerr<<"the modified value is: "<<i<<endl;

where macro.C contains

//macro.C
{
  *i_p = 123;
}

Is there a more elegant way to bind variables of the program to
the interpreted variables of CINT? Or call interpreted functions on
variables of the program?
First of all: is it safe? Does CINT use the same representations for ints,
doubles etc, as the program? Might this be used not only for ints,
doubles, etc, but also for stl::vector?
Thanks
Daniel



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