there are basically three cases:
1) using LinkDef in the advertised way, i.e. turning first everything off
and then selectively activating dictionary generation for the required
globals, functions and classes. This works.
2) using LinkDef with everything turned on (#pragma link C++ all classes)
this will result in all classes available via the parsed include
file AND the includes it contains to be exported. I.e. also all the ROOT of
or other classes that are visible via the original include file.
To prevent that from happening one can add
#ifdef __CINT__
#include <do not parse by cint>
#endif
around the includes. This is a bit of a mess.
3) don't specify a LinkDef file. In that case rootcint will create a
default LinkDef file which only exports the class with the name
equal to the include file minus .h extension. In your case this
did not work since your include TestClass.h contained the class TestClass1.
Change include to TestClass1.h and it will export properly the class.
This last solution is aimed at quick testing of dictionary generation.
For ROOT iteself we always use method 1).
Cheers, Fons.
R. Eastman wrote:
>
> Salutations,
>
> I'm a little confused about how the "link" pragmas work and what they
> are doing. The motivation for my asking is that I would like to be
> able to pass the existing source through rootcint and have it generate
> interface stubs for the extern's and classes they contain, so that the
> variables are visible to the parser, without having to write a
> seperate "pragma link" statement for each class, variable,...
>
> Below are five small files of a simple little test code: Main.C,
> TestClass.h, TestClass.C, and LinkDef.h. The LinkDef.h file uses the statement
> #pragma link off all globals
> etc, which should turn off generation of interface stubs, and it then
> then lists each variable, class, etc for which an interface should be created:
> #pragma link C++ global gX
> This works. My understanding, however, from looking at the file
> UTILS_rootcint.cxx and also the documentation on makecint, is that by
> default an interface stub will be created for all global symbols and
> defined classes, which would be equivalent to
> #pragma link C++ all classes
> etc. However, when I do this, I get
>
-- Org: CERN, European Laboratory for Particle Physics. Mail: 1211 Geneve 23, Switzerland Phone: +41 22 7679248 E-Mail: Fons.Rademakers@cern.ch Fax: +41 22 7677910