Namespace in interpreter (CINT)

Dear ROOTers,
I have following problem, I have class A and namespace B - all of them in one library (libAB).
class A looks like this:

using namespace B;
class A{
	MyEnum fField;
	...
}

my header with enum look like this:

namespace B{
	enum MyEnum{
	...
	}
}

I put in linkdef

#pragma enum MyEnum;
#pragma namespace B;

However MyEnum is not “visibible” in CINT until loading libAB or calling new A() (makefile puts libraries in LD_LIBRARY_PATH).
Why CINT is able to recognize that it need to load libAB when I need class but is not able to do the same thing for namespace? Is there way to enable such support for namespaces?

Hi,

the correct syntax for selecting namespaces is

#pragma link C++ namespace MyNamespace;

You can find the full documentation here: root.cern.ch/selecting-dictiona … s-linkdefh

In addition, I don’t think rlibmap is able to add autoload keys to the rootmaps for enumerators. On the other hand, this feature has been added to ROOT6, e.g. version 6.06.

Cheers,
Danilo

Hi,

[quote]Why CINT is able to recognize that it need to load libAB when I need class but is not able to do the same thing for namespace?[/quote]A namespace can have declaration among many libraries. If we were to support autoloading solely based on a namespace we would then need to load every single library that declares any part of the namespace which is almost all cases would be much more than intended.

Cheers,
Philippe.