You are here

How to generate a dictionary

A dictionary is a source file that once compiled, linked into a library or executable and loaded into a process will give to CINT all the information its need about a type or variable. A dictionary is essential for a C++ to entity to useable from a CINT script or to be Streamed in or out of a ROOT file.

You have 3 options to create a dictionary.

Use ACLiC to generate the dictionary for everything defined in a source or header file:

root [] .L myScript.cxx+

or (from compiled code):

gROOT->ProcessLine(".L myScript.cxx+")
To generate the dictionary for a single class or for a class template instance use (with ROOT v5.27/06 and above):
gInterpreter->GenerateDictionary("vector<Track&gt","Track.h;vector");
gInterpreter->GenerateDictionary("myclass","myheader.h");
To generate the dictionary from a Makefile, you can use the following rule to generate a dictionary for the headers $(HEADERS) and a library containing the dictionary and the compiled $(SOURCES):
MyDict.cxx: $(HEADERS) Linkdef.h
[TAB]     rootcint -f $@ -c $(CXXFLAGS) -p $^

libMyLib.so: MyDict.cxx $(SOURCES)
[TAB]     g++ -shared -o$@ `root-config --ldflags` $(CXXFLAGS) -I$(ROOTSYS)/include $^

See Interacting with Shared Libraries: rootcint for more details.

Add new comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
2 + 8 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.