RE: Erratic TInterpreter::GetInterfaceMethod behaviour?

From: Bertrand Bellenot <Bertrand.Bellenot_at_cern.ch>
Date: Mon, 28 Mar 2011 10:52:39 +0000


Hi,

For me, adding gROOT->ProcessLine("#include <iostream>"); in your main() solved the problem. I.e.:

int main (int argc, char const *argv[])
{
  gROOT->ProcessLine("#include <iostream>");   ReadC();
}

Maybe Philippe could explain why this is needed in this case.

Cheers, Bertrand.

-----Original Message-----
From: owner-roottalk_at_root.cern.ch [mailto:owner-roottalk_at_root.cern.ch] On Behalf Of Nicholas Devenish Sent: 28 March 2011 12:15
To: roottalk_at_root.cern.ch
Subject: [ROOT] Erratic TInterpreter::GetInterfaceMethod behaviour?

I'm seeing a little erratic GetInterfaceMethod behaviour between my compiled program and running in root direct, and I don't know how to track it down. Perhaps there is some interpreter initialisation I need to do first? I've attached a test script that writes out a basic .C macro, then attempts to load it and read the address of a function out of it with the prescription:

  gROOT->LoadMacro(filename);
  TInterpreter* interp = gROOT->GetInterpreter();   void* func = interp->GetInterfaceMethod(0,funcname,"");   return (bool)func;

Running through root gives:
$ root ReadC.C

Result of search: 1

Running through ACLIC gives:
$ root ReadC.C+

Result of search: 1

But compiling as a stand-alone program gives a different answer:
$ g++ -o ReadC ReadC.C `root-config --cflags --libs` $ ./ReadC Failed to load function Result of search: 0

Unfortunately, getting this to work is a necessity, as a pretty ingrained part of our codebase relies on this behaviour (most people run through rootscripts). Does anyone know what is causing this? I tested on 5.27/02 and 5.28/00 and both exhibited this behaviour.

Thanks,

Nick Received on Mon Mar 28 2011 - 12:52:44 CEST

This archive was generated by hypermail 2.2.0 : Mon Mar 28 2011 - 17:50:02 CEST