Using ROOTCINT


The rootcint program generates the Streamer(), TBuffer &operator>>() and ShowMembers() methods for ROOT classes, i.e. classes using the ClassDef and ClassImp macros.
In addition rootcint can also generate the CINT dictionaries needed in order to get access to ones classes via the interpreter.

Rootcint can be used like:

  rootcint TAttAxis.h[-][!] ... [LinkDef.h] > AxisGen.C
or
  rootcint [-f] [AxDict.C] [-c] TAttAxis.h[-][!] ... [LinkDef.h]
The difference between the two is that in the first case only the Streamer() and ShowMembers() methods are generated while in the latter case a complete compileable file is generated (including the include statements). The first method also allows the output to be appended to an already existing file (using >>). The optional minus behind the include file name tells rootcint to not generate the Streamer() method. A custom method must be provided by the user in that case. When using option -c also the interpreter method interface stubs will be written to the output file (AxDict.C in the above case). By default the output file will not be overwritten if it exists. Use the -f (force) option to overwite the output file.

Before specifying the first header file one can also add include file directories to be searched and preprocessor defines, like:

   -I$../include -DDebug
The (optional) file LinkDef.h looks like:
#ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ class TAxis;
#pragma link C++ class TAttAxis-;
#pragma link C++ class TArrayC-!;
#pragma link C++ function StrDup;
#pragma link C++ function operator+(const TString&,const TString&);
#pragma link C++ global gROOT;
#pragma link C++ global gEnv;
#pragma link C++ enum EMessageTypes;
#endif
This file tells rootcint for which classes the method interface stubs should be generated. A trailing - in the class name tells rootcint to not generate the Streamer() method. This is necessary for those classes that need a customized Streamer() method. A trailing ! in the class name tells rootcint to not generate the operator>>(TBuffer &b, MyClass *&obj) method. This is necessary to be able to write pointers to objects of classes not inheriting from TObject. When this file is not specified a default version exporting the classes with the names equal to the include files minus the .h is generated.
 

*** IMPORTANT ***

  1. LinkDef.h must be the last argument on the rootcint command line.
  2. Note that the LinkDef file name MUST contain the string:
    LinkDef.h or linkdef.h, i.e. NA49_LinkDef.h is fine just like, mylinkdef.h.

Rene Brun, Fons Rademakers
Last update 29/10/97 by FR