Generate LinkDef entries for class (or function) template instances


I was wondering if ROOT (i.e. rootcling) can do the following for me: generate the LinkDef entries for all the class template instances (that either derive from TObject or have a ClassDef macro) in my program. Or maybe have some kind of a wildcard functionality to avoid long lists of class template entries in my LInkDef file. This because I am facing the following situation:

I have several class templates such as MyClass<T, N> that take one or more template arguments. I want to do I/O with instances of these classes, but I find myself to have to list all the used combination of parameters in my LinkDef.h; otherwise rootcling will complain about undefined references of its Class(), IsA() and Streamer() methods (which are only generated in the dictionary when I enlist them in the LinkDef).

Is it possible for rootcling to just generate the entries of these class template instances, instead of complaining about them? Since all the used template instances are known at compile time this should in theory be possible. Or if it already is, how do I do it?

Looking forward to a reply!


Hi Ahmad,

selection xml files, supported by genreflex, provide wildcard functionality while linkdefs unfortunately do not.


Hi Danilo,

Thanks for your reply. Genreflex seems to be exactly what I need. It seems to be much more convenient than LinkDef for dictionary generation. However I’m facing an issue with it. I opened a separate topic here: Genreflex - Warning: Unused class rule

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.