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

From: Pasha Murat (630)840-8237 FNAL (630)859-3463 home (murat@murat.fnal.gov)
Date: Sun Oct 22 2000 - 05:02:20 MEST


hi - 

for example, you can use a compiled class interpreted by CINT
(I mean that the one with compiled dictionary)  for the 
communication between the compiled and the interpreted code. 
This is safe and doesn't introduce any alignment problems -
everything is happening "on compiled side" and CINT only 
provides the user interface.
					best, Pasha


Daniel Barna wrote:
> 
> 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