Re: rootcint: processing of #pragma directives

Gordon Watts (gwatts@fnal.gov)
Fri, 24 Oct 1997 15:31:15 -0500


On Fri, Oct 24, 1997 1:06 PM, Pasha Murat <mailto:murat@cdfsga.fnal.gov>
wrote:
>
> Hello,
>
>I'm hitting the same problem the second time, so I believe it deserves to
be
>reminded.
>
> Right now (this has been discussed some time ago in the thread
> "Rootcint and linear algebra classes") rootcint *ignores* "#pragma link"
> directives in the processed include files themselves. Instead it
> can generate LinkDef.h automatically by just looking at the names of
> the input files. This imposes the following rules:
>
>- each include file should contain definition of one and only one class;
>- include file name should coinside with the class name (spelled in right
case!)
> minus extention.
>
> may be everybody follow these rules by default but sometimes this
> feature is pretty inconvenient... And after looking over the
> documentation again I didn't find this feature described. May be I just
> missed it, if not - it definitely deserves to be added (*in red*)
> to the section "CINT as Dictionary Generator".
>
> It seems to be reasonable if rootcint could process
> #pragma directives from the input files.
>
> Regards, Pasha.
>
>

Yeah, I fought with this for a while, then I saw the LinkDef.h file sitting
in the $(ROOTSYS)/test/ directory that is used when building the Event
sample. In there it does almost what you are talking about -- it has the
#pragma directives. Note that the first this this file does is turn off the
automatic generation of the routines from filenames (I'm sorry; I'm not
near a computer with root on it right now).

My suggestion is to copy this file over to your project, modify it so that
it defines the correct classes, and then append it to your rootcint guy:

rootcing -f junkDict.cpp -c junk.h nice_day.h chicago_is_cold.h LinkDef.h

And if those three .h files define classes A, B, C, and D, then in
LinkDef.h you'll have the #pragma C++ link commands, one for each class.
And no errors about undefined classes junk, nice_day, or chicago_is_cold.
At least, that is how it works for me with 1.03/05.

I was also unable to find a reference to these pragma's in the docs and it
was just luck I stumbled across them. Perhaps it would be good to put in a
reference.

Cheers,
Gordon.