# Load a standalone sharedlibrary

**URL:** <https://root-forum.cern.ch/t/load-a-standalone-sharedlibrary/28306>\
**Category:** ROOT\
**Created:** [March 13, 2018, 9:33pm UTC](https://root-forum.cern.ch/t/load-a-standalone-sharedlibrary/28306 "2018-03-13T21:33:52Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Viesturs](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/v/7cd45c/32.png) [@Viesturs](https://root-forum.cern.ch/u/Viesturs)\
**Post date:** [March 13, 2018, 9:33pm UTC](https://root-forum.cern.ch/t/load-a-standalone-sharedlibrary/28306/1 "2018-03-13T21:33:52Z")

</div>

I have a a shared library

$PROJECT/lib/libCustomClass.so

How can I use it in CLING?

---

<div class="post-metadata">

**Author:** ![berserker](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/berserker/32/17693_2.png) [@berserker](https://root-forum.cern.ch/u/berserker)\
**Post date:** [March 13, 2018, 10:37pm UTC](https://root-forum.cern.ch/t/load-a-standalone-sharedlibrary/28306/2 "2018-03-13T22:37:50Z")

</div>

Add `R__LOAD_LIBRARY($PROJECT/lib/libCustomClass.so)` somewhere at the top of your file, like in [https://root.cern.ch/doc/v610/copytree\_8C.html](https://root.cern.ch/doc/v610/copytree_8C.html)

---

<div class="post-metadata">

**Author:** ![Viesturs](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/v/7cd45c/32.png) [@Viesturs](https://root-forum.cern.ch/u/Viesturs)\
**Post date:** [March 14, 2018, 11:39am UTC](https://root-forum.cern.ch/t/load-a-standalone-sharedlibrary/28306/3 "2018-03-14T11:39:18Z")

</div>

What if I work directly in the CLING interactive environment?

---

<div class="post-metadata">

**Author:** ![berserker](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/berserker/32/17693_2.png) [@berserker](https://root-forum.cern.ch/u/berserker)\
**Post date:** [March 14, 2018, 3:55pm UTC](https://root-forum.cern.ch/t/load-a-standalone-sharedlibrary/28306/4 "2018-03-14T15:55:30Z")

</div>

Then run `gSystem->Load("$PROJECT/lib/libCustomClass.so");` command.

---

<div class="post-metadata">

**Author:** ![Viesturs](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/v/7cd45c/32.png) [@Viesturs](https://root-forum.cern.ch/u/Viesturs)\
**Post date:** [March 14, 2018, 5:20pm UTC](https://root-forum.cern.ch/t/load-a-standalone-sharedlibrary/28306/5 "2018-03-14T17:20:14Z")

</div>

How can I tell root where to look for header files referenced in the library?

---

<div class="post-metadata">

**Author:** ![Danilo](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/danilo/32/34528_2.png) [@Danilo](https://root-forum.cern.ch/u/Danilo)\
**Post date:** [March 15, 2018, 8:38am UTC](https://root-forum.cern.ch/t/load-a-standalone-sharedlibrary/28306/6 "2018-03-15T08:38:37Z")

</div>

Hi,

the information about headers is in the dictionaries. If you did not run dictionaries, you need to include the necessary headers with the usual preprocessor include directive.

D

---

<div class="post-metadata">

**Author:** ![Viesturs](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/v/7cd45c/32.png) [@Viesturs](https://root-forum.cern.ch/u/Viesturs)\
**Post date:** [March 15, 2018, 8:50am UTC](https://root-forum.cern.ch/t/load-a-standalone-sharedlibrary/28306/7 "2018-03-15T08:50:55Z")

</div>

What do you mean by “run dictionaries”? Can you give an example?  
The include directive is included e.g.

#include “interface/classA.hh”

but CLING does not know where the folder interface is located.

---

<div class="post-metadata">

**Author:** ![Danilo](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/danilo/32/34528_2.png) [@Danilo](https://root-forum.cern.ch/u/Danilo)\
**Post date:** [March 15, 2018, 8:58am UTC](https://root-forum.cern.ch/t/load-a-standalone-sharedlibrary/28306/8 "2018-03-15T08:58:01Z")

</div>

Hi,

if you are in ROOT (I make this Ansatz since you posted in the ROOT category), you can instruct the tool about the headers location via the ROOT\_INCLUDE\_PATH environment variable, which can be formatted as LD\_LIBRARY\_PATH.

Cheers,  
D

---

<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:** [March 29, 2018, 8:58am UTC](https://root-forum.cern.ch/t/load-a-standalone-sharedlibrary/28306/9 "2018-03-29T08:58:06Z")

</div>

Closed on March 29, 2018, 8:58am UTC

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