RE: [ROOT] compilation

From: Philippe Canal (pcanal@fnal.gov)
Date: Thu Feb 22 2001 - 00:02:46 MET


Hi Jacek,

Here is a summary of the current situation (3.05).

CINT and rootcint handled properly the following header files
  - most compilers headers (like stream.h, stdio.h).  the complete
	list is at $ROOTSYS/cint/include
  - All headers of previously loaded libraries (including ROOT's own)
	that have the SAME name as a class known to ROOT (i.e. a class
	with a ClassDef).

CINT interpreted mode does not like the following header files because
if they are included by the interpreter it defines its content as
interpreted functions/classes/variables even-though it exists as compiled
code.

  - All of CINT header files (like API.h)
  - Header files that do not define classes by the same name
	(like RType.h, GuiTypes.h, etc...)
  - Header files declaring classes (etc.) that are defined in
	a library you did not load yet.  (For example doing a
	#include "TLorenzVector.h" __before__ doing a gSystem->Load("libPhysics") )

ROOTCINT can handle any include files that do not contain syntax that is
illegal
for CINT (see Cint limitations:
http://root.cern.ch/root/Cint.phtml?limitations )

Hiding from ROOTCINT header files that are necessary for compilation but
are optional when using the interpreter can lead to a subtle but fatal
errors!

For example:

#ifndef __CINT__
#include "TTree.h"
#else
class TTree;
#endif

class subTree : public TTree {
....
};

When rootcint is ran, it will NOT have enough information about the TTree
class
to produce the correct dictionary file.  [If you try this, both rootcint and
the compilation will finish without error, however trying to create a
subTree
object will lead to a core dump.]

So as matter of precaution it is better to let rootcint see as many header
files
as possible.

So a refinement Jacek's previous example could be

	#include <stdio.h>
	#include <stream.h>
	#include "TROOT.h"
	#include "TTree.h"
	#include "TFile.h"

	#ifndef __CINT__
	#include "Api.h"
 	#endif

Philippe.



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:37 MET