Dictionary in a static library

Hi all,

I have a class, MyClass, which is compiled to MyClass.o. I have a dictionary generated for that class, the respective code is compiled into MyClass_dict.o. Both object files are archived into libMyLib.a. Now I am (successfully) compiling my executable, MyExec_x by linking against libMyLib.a: -L/path/to/lib -lMyLib. Unfortunately, at runtime, the dictionary for MyClass is not loaded and I get a runtime error:

Error in <TClass::Load>: dictionary of class MyClass not found Error in <TList::AddLast>: argument is a null pointer

I can fix this by explicitetly adding MyClass_dict.o to the build command. But since that object file is in the library already, I expect there must be a way to avoid that explicit reference to the object file, is there? Thanks a lot!


You could either use a shared library (in which case the loading of the dictionary would be automatic) or explicitly request one of the symbol from the dictionary file on the link like.
Depending on your platform you might be able to use (a variant of):