# About documenting R\_\_LOAD\_LIBRARY (i.e. using ROOT-compiled classes in ROOT scripts)

**URL:** <https://root-forum.cern.ch/t/about-documenting-r-load-library-i-e-using-root-compiled-classes-in-root-scripts/33565>\
**Category:** ROOT\
**Created:** [April 12, 2019, 9:35am UTC](https://root-forum.cern.ch/t/about-documenting-r-load-library-i-e-using-root-compiled-classes-in-root-scripts/33565 "2019-04-12T09:35:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![malfonsi79](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/m/22d042/32.png) [@malfonsi79](https://root-forum.cern.ch/u/malfonsi79)\
**Post date:** [April 12, 2019, 9:35am UTC](https://root-forum.cern.ch/t/about-documenting-r-load-library-i-e-using-root-compiled-classes-in-root-scripts/33565/1 "2019-04-12T09:35:15Z")

</div>

Dear all,

since I migrated to ROOT 6, I started to add at the beginning of my “one-main-function” scripts the following lines to make available to this script the class code that I have compiled with `gSystem->CompileMacro`:

```auto
// As of ROOT 6.04, this is the way to expose the symbols of these
// compiled libraries into a script.
R__LOAD_LIBRARY(PMTtestChannel)
#include "PMTtestChannel.hpp"

```

It works and I do not need to call `gROOT->Load()` in some place in the script. However, should I keep these lines if the script, after renaming my-one-main-function() to main(), is compiled to produce an executable?

At the time I thought it was a temporary workaround and I cannot find anymore the source of this information (very likely a forum post). So I am wondering if this is still the correct way to do and if you have a tutorial or any other documentation about this topic. For example it is not mentioned in the User’s Manual chapter “Adding a class” (and I am always afraid that this big manual adapted from ROOT 5 is not representative of the forefront of the ROOT development)

I think that having a how-to/tutorial/official explanation on this topic in a place easy to find would be beneficial

Matteo

* * *

_ROOT Version:_ 6.16.00  
_Platform:_ Debian 9  
_Compiler:_ gcc 6.3

* * *

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [April 12, 2019, 9:51am UTC](https://root-forum.cern.ch/t/about-documenting-r-load-library-i-e-using-root-compiled-classes-in-root-scripts/33565/2 "2019-04-12T09:51:45Z")

</div>

In short, [“R\_\_LOAD\_LIBRARY” does nothing in a (pre)compiled macro](https://root-forum.cern.ch/t/gsystem-load-vs-r-load-library-with-aclic/29685).

See also:

> [@How to compile my code](https://root-forum.cern.ch/t/how-to-compile-my-code/32780/3):
>
> #include "TH1.h" // "ROOT Script" entry point. void wth() { TH1F \*aPointer = new TH1F("a", "a", 10, 0., 1.); aPointer-\>Draw(); } #if !defined(\_\_CINT\_\_) && !defined(\_\_CLING\_\_) && !defined(\_\_ACLIC\_\_) // "Standalone Application" entry point. // `root-config --cxx --cflags` -o wth wth.cc `root-config --libs` int main() { wth(); return 0; } #endif /\* !defined(\_\_CINT\_\_) && !defined(\_\_CLING\_\_) && !defined(\_\_ACLIC\_\_) \*/ BTW. When you post “source code” or “output” here, do remember to enclose…

> [@ROOT 6 / CLING / rootcling replacements for (\_\_CINT\_\_), (\_\_MAKECINT\_\_) and (\_\_ACLIC\_\_) macros](https://root-forum.cern.ch/t/root-6-cling-rootcling-replacements-for-cint-makecint-and-aclic-macros/27698):
>
> I am looking for ROOT 6 / CLING / rootcling replacements for ROOT 5 / CINT / rootcint macros \_\_CINT\_\_, \_\_MAKECINT\_\_ and \_\_ACLIC\_\_ (I would like to get rid of any ROOT 5 / CINT / rootcint dependencies in new ROOT 6 / CLING / rootcling source code): #if defined(\_\_CINT\_\_) && !defined(\_\_MAKECINT\_\_) // source code being actually interpreted by cint #elif defined(\_\_MAKECINT\_\_) // source code seen by rootcint only #elif defined(\_\_ACLIC\_\_) // source code being actually compiled by ACLiC #else // source…

---

<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:** [April 26, 2019, 9:51am UTC](https://root-forum.cern.ch/t/about-documenting-r-load-library-i-e-using-root-compiled-classes-in-root-scripts/33565/3 "2019-04-26T09:51:50Z")

</div>

Closed on April 26, 2019, 9:51am UTC

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