# Embed rootcling in a compiled C++ program

**URL:** <https://root-forum.cern.ch/t/embed-rootcling-in-a-compiled-c-program/40437>\
**Category:** Cling\
**Created:** [July 14, 2020, 6:00pm UTC](https://root-forum.cern.ch/t/embed-rootcling-in-a-compiled-c-program/40437 "2020-07-14T18:00:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![yipengsun](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/yipengsun/32/22782_2.png) [@yipengsun](https://root-forum.cern.ch/u/yipengsun)\
**Post date:** [July 14, 2020, 6:00pm UTC](https://root-forum.cern.ch/t/embed-rootcling-in-a-compiled-c-program/40437/1 "2020-07-14T18:00:10Z")

</div>

Hi,

In [this post](https://root-forum.cern.ch/t/embedding-cling-in-a-compiled-c-program/24038) I learned how to embed stand-alone `cling` to a compiled C++ program.

I want to do something similar, but I don’t want to introduce another dependency (stand-alone `cling`), if possible.

I browsed the headers installed on my computer:

```auto
root /etc/root/cling/
root /etc/root/cling/Interpreter/
root /etc/root/cling/Interpreter/DynamicExprInfo.h
root /etc/root/cling/Interpreter/DynamicLookupLifetimeHandler.h
root /etc/root/cling/Interpreter/DynamicLookupRuntimeUniverse.h
root /etc/root/cling/Interpreter/Exception.h
root /etc/root/cling/Interpreter/RuntimePrintValue.h
root /etc/root/cling/Interpreter/RuntimeUniverse.h
root /etc/root/cling/Interpreter/Value.h

```

And some of the required headers, such `cling/Utils/Casting.h` seems to be missing.

So, can just use the header files provided by a ROOT binary distribution and embed `rootcling` or `cling` to a compiled C++ program, without any additional dependencies?

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [July 15, 2020, 9:00am UTC](https://root-forum.cern.ch/t/embed-rootcling-in-a-compiled-c-program/40437/2 "2020-07-15T09:00:58Z")

</div>

@vvassilev might know better if this is possible

---

<div class="post-metadata">

**Author:** ![vvassilev](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/v/f0a364/32.png) [@vvassilev](https://root-forum.cern.ch/u/vvassilev)\
**Post date:** [July 15, 2020, 9:16am UTC](https://root-forum.cern.ch/t/embed-rootcling-in-a-compiled-c-program/40437/3 "2020-07-15T09:16:40Z")

</div>

Unfortunately no. You do not get the cling binary as part of the root distribution due to the different setup we use to build ROOT’s libCling. `rootcling` is a tool which produces dictionaries and has a very little to do with `cling` standalone.

The way you can embed cling is described briefly here: [https://rawgit.com/vgvassilev/cling/master/www/index.html](https://rawgit.com/vgvassilev/cling/master/www/index.html)

---

<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:** [July 15, 2020, 9:51am UTC](https://root-forum.cern.ch/t/embed-rootcling-in-a-compiled-c-program/40437/4 "2020-07-15T09:51:33Z")

</div>

IIRC … In the good old days, when @brun ruled this world, the “cint” executable was also automatically built together with “root”. Why not return to this good old practice so that now the “cling” executable is provided, too?

---

<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:** [July 29, 2020, 9:51am UTC](https://root-forum.cern.ch/t/embed-rootcling-in-a-compiled-c-program/40437/5 "2020-07-29T09:51:35Z")

</div>

Closed on July 29, 2020, 9:51am UTC

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