# Add search path for dictionaries

**URL:** <https://root-forum.cern.ch/t/add-search-path-for-dictionaries/62726>\
**Category:** ROOT\
**Created:** [January 22, 2025, 1:56pm UTC](https://root-forum.cern.ch/t/add-search-path-for-dictionaries/62726 "2025-01-22T13:56:56Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nicko](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/n/c2a13f/32.png) [@nicko](https://root-forum.cern.ch/u/nicko)\
**Post date:** [January 22, 2025, 1:56pm UTC](https://root-forum.cern.ch/t/add-search-path-for-dictionaries/62726/1 "2025-01-22T13:56:57Z")

</div>

I am developing a ROOT plugin for a plugin-based application framework. For classes that need it, I am generating a dictionary via

ROOT\_GENERATE\_DICTIONARY(G\_\_example include/example.h MODULE example LINKDEF include/ExampleLinkDef.h)

Which produces:  
libexample\_rdict.pcm libexample.rootmap libexample.so module.modulemap

So far so good. However I need to tell ROOT where to find these. It is only able to find them if I copy them in the working directory, which is inconvenient for deployment (every plugin is supposed to be self contained in its folder).

Is there a way to set a search path for these files? Either absolute or relative to the position of the .so would work…  
I only found TSystem::AddIncludePath and TSystem::AddDynamicPath in the documentation, neither of which does what I want.

---

<div class="post-metadata">

**Author:** ![pcanal](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pcanal/32/12439_2.png) [@pcanal](https://root-forum.cern.ch/u/pcanal)\
**Post date:** [January 22, 2025, 2:41pm UTC](https://root-forum.cern.ch/t/add-search-path-for-dictionaries/62726/2 "2025-01-22T14:41:58Z")

</div>

You can set the `LD_LIBRARY_PATH` or `ROOT_LIBRARY_PATH` shell environment variables.

---

<div class="post-metadata">

**Author:** ![nicko](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/n/c2a13f/32.png) [@nicko](https://root-forum.cern.ch/u/nicko)\
**Post date:** [January 22, 2025, 4:18pm UTC](https://root-forum.cern.ch/t/add-search-path-for-dictionaries/62726/3 "2025-01-22T16:18:14Z")

</div>

Thank you, I’m assuming there is no way to do it directly from c++ then?  
I’m a bit hesitant to mess with environment variables for this purpose because it breaks the “encapsulation” of our plugins. I could call setenv from inside the ROOT plugin(s) but I’m not sure I can do this before ROOT looks at the content of the variable. Can you tell me when that happens?

---

<div class="post-metadata">

**Author:** ![pcanal](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/pcanal/32/12439_2.png) [@pcanal](https://root-forum.cern.ch/u/pcanal)\
**Post date:** [January 22, 2025, 6:25pm UTC](https://root-forum.cern.ch/t/add-search-path-for-dictionaries/62726/4 "2025-01-22T18:25:42Z")

</div>

You could also update a `.rootrc`’s `Unix.*.Root.DynamicPath` value.  
Although `gSystem->AddDynamicPath(..)` should also have worked.

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [February 5, 2025, 6:26pm UTC](https://root-forum.cern.ch/t/add-search-path-for-dictionaries/62726/5 "2025-02-05T18:26:09Z")

</div>

Closed on February 5, 2025, 6:26pm UTC

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
