macro in order to have HTML documentation, and in my LinkDef file
I added
#pragma link C++ namespace KVTGIDFunctions;
again based on the way TMath is compiled in ROOT. I didn’t see anything else special about TMath (there is no ClassDef or ClassImp macro in the source - it’s not a class, so that seems logical enough ).
Everything goes OK, then when I try to load the library I get
The namespace definition I posted first is in KVTGIDFunctions.h.
KVTGIDFunctions.cpp contains the implementation of the functions,
as well as the NamespaceImp macro, à la TMath.
I’ve narrowed it down :
I only get the load error if I include NamespaceImp(KVTGIDFunctions) in KVTGIDFunctions.cpp.
I implemented this exactly the same way as in TMath.cxx - I even put the “Class Description” comment block before the macro instead of after, because that’s the way it’s done in TMath.cxx.
So there must be something else in the TMath source that I missed.
Any offers ?
namespace KVTGIDFunctions {
namespace ROOT {
inline ::ROOT::TGenericClassInfo *GenerateInitInstance();
static void KVTGIDFunctions_Dictionary();
// Function generating the singleton type initializer
inline ::ROOT::TGenericClassInfo *GenerateInitInstance()
{
static ::ROOT::TGenericClassInfo
instance("KVTGIDFunctions", 0 /*version*/, "identification/KVTGIDFunctions.h", 47,
::ROOT::DefineBehavior((void*)0,(void*)0),
&KVTGIDFunctions_Dictionary, 0);
return &instance;
}
// Static variable to force the class initialization
static ::ROOT::TGenericClassInfo *_R__UNIQUE_(Init) = GenerateInitInstance(); R__UseDummy(_R__UNIQUE_(Init));
// Dictionary for non-ClassDef classes
static void KVTGIDFunctions_Dictionary() {
GenerateInitInstance()->GetClass();
}
}
}
As I said in my last post, things work fine if I just leave out “NamespaceImp”, but I would really like to have HTML documentation for this namespace,
as much for myself as for the rest of my collaboration. And then it’s frustrating to see something work for TMath but not for me…
I’m sending you a .tgz with all the necessary files.
Unpack it, then in the top-level directory type ‘make’.
The shared lib libKVMultiDet.so will be in the lib/ directory.
The two files defining the namespace are
KVMultiDet/identification/KVTGIDFunctions.h
KVMultiDet/identification/KVTGIDFunctions.cpp
The LinkDef file is
KVMultiDet/KVMultiDetLinkDef.h
The difference between your case and the TMath case is that your dictionary is built with -O. Make sure that it is NOT built with -O and the problem goes away.
Cheers,
Philippe.
PS. A new implementation of THtml is nearing completion and will not really on ClassImp
Thanks a lot, that works fine. I remove the “-O” flag from the CXXFLAGS given by $ROOTSYS/test/Makefile.arch and use this non-optimised version CXXFLAGS_NOOPT to compile my dictionaries, while compiling everything else with the ususal CXXFLAGS.