Use ROOT IO as library in a C++ stand alone project

Dear developers,

from time to time I am ask about how to use ROOT IO dictionaries in a stand alone C++ project.

I pushed the code into the github, but maybe it can be a beneficial if it is adapted and distributed as part of the ROOT examples or tutorials.

The code creates a shared library and a ROOT dictionary for a given class, which is later used to write and read from a TTree.

The ROOT documentation has improved a lot since I wrote that example, but I was not able to find a complete minimal working example of this ROOT feature.

I am at your disposal and happy to contribute :slight_smile:

Best regards,


Hi @atd,

Many thanks for the contribution! A simple example as this can actually be added as a tutorial, probably under tutorials/tree/. Usually, tutorial files include inline comments describing each step and/or general considerations.
Are you up for making a pull request on the ROOT repository for this? Otherwise, we could discuss other possibilities.

Indeed, last year we dedicated two weeks to improve the documentation. We are happy to hear that the results are visible! :slight_smile:


Hi @jalopezg

I would be happy to do a PR on the ROOT repo :slight_smile:


1 Like

In a form of a tutorial ?

Hi @couet

I was thinking to add the code inside a dedicated folder, something like tutorials/tree/dictionary/

as this other existing example: tutorials/webgui/qtweb/, with dedicated and CMakelists files inside

would you prefer to just expand the webpage?

Any preference, @couet?

IMHO, a tutorial would be awesome, provided that the documentation is extended (e.g., by explaining the required steps).

Yes may be a dedicated folder is better. But as it is in tree I think we should ask @pcanal who is responsible of that part of the ROOT code. That’s up to him to decide.