Hi ROOTers,
  I'm trying to use ROOT as a "callable" interpreter. Say, I have an
object in the compiled program on which I want to run an interpreted
code. Let's say I have following code:
  // --- test1.h - will be processed with |rootcint|
  class A {
    public:
      A(int) {}
      // ....
    private:
      // ....
  };
  // --- test2.cxx - this the interpreted code
  class B {
    public:
      B() {}
      doSomething(const A*) {}
  };
Now what I want is to create an object of class A in the compiled code
and pass it to the B::doSomething(). I have something like this in the
main():
   TApplication *theApp = new TRint(appname, &argc, argv, 0, 0);
   theApp->ProcessLine(".L test2.cxx");    // load interpreted code
   theApp->ProcessLine("B *b = new B;");   // create an instance of
class B in interpreter
   A *a = new A ;                          // make an instance of "A" in
compiled program
   // Now how do I?
   theApp->ProcessLine("b->doSomething(a);"); // "a" means above
allocated a
All I could think of is to take an address of "a" and make a cast,
something like that:
  char buf[64] ;
  sprintf ( buf, "b->doSomething((A*)%d);", &a ) ;
  theApp->ProcessLine( buf ) ;
That looks quite clumsy, and I'm not at all sure this will work. So,
does someone have a nice solution for this? Probably I should play with
the dictionary to make "a" seen to the interpreter? But how do I do
this?
  Cheers,
  Andy.
This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:36 MET