Int main(int argc, char* argv[])

Dear Sirs.

At the first, if I’m OFF, I beg your pardon then.

My question is:
AFAIU I’m able to call only main() function when I’m using CINT. No other function to be called. Actaully that is the problem, Is there any way to call other function with some specific parameters. Of if not it might be somebody having the similar problems before wrote somewhat of the dispatcher function by the means of the which would be possible to call other function then the main() one.
For instance, let CINT file looks like this:

void function(int nValue) {
  printf("%d", nValue)

void main() {

I would like to call function() directly, avoiding the call of main() one, if I’m going to use CINT API.

Is there any way to do that?

Thank you.

If your script is called script.C, do
root > .L script.C
root > function(8)

Note that in your example, you should replace
printf("%d", nValue)
printf("%d\n", nValue);

Please read the Users Guide. Execution of scripts is explained at length.


Dear brun.

Thank you very much for your replay.

It seems like I have founf I need;


I was looking to possibility to call scriptinf funtion from C code, by means of CINT API. I do believe G__CallFunc is what I need.

I do believe it is possible to use CINT API by menas of CINT. I mean to write CINT’s scripts which will use CINT API’s functions, is it?

The kind regards.

Hi Georges,

Only a very small fraction of the CINT API is available on the ROOT prompt. In the context of ROOT, it is recommended to use the interfaces described at or simply by using gROOT->ProcessLine("func(arg1…)’);


Hi Philippe, if you do not mind :wink:
I would recommend to use gInterpreter->ProcessLine
Under windows it is thread safe.

Regards. Valeriy

Hi Valeriy,

TROOT::ProcessLine and TInterpreter::ProcessLine are not equivalent.
TROOT::ProcessLine adds several features before calling TInterpreter::ProcessLine.


If you are using pure Cint and want to call an interpreted function without using main(), you can do that in several different ways. That shouldn’t be so tricky. Cint calls main() if it finds one, but if there isn’t, interactive command interface is invoked. Then you can call it using ‘p function(0)’ or ‘{ function(0); }’.

Alternatively, you can use Cint APIs. Please read cint/doc/ref.txt. I guess G__calc() and G__loadfile() are of your interest.

Thank you
Masa Goto