Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using cling inside C++, how to do it?

For a school project my team and I are working on a project in which we are required to use the cling interpreter. We watched several youtube videos about cling and all got it compiled and working on our systems.

The problem we are facing is that we can't seem to find out how we can call cling functions from within our c++ code. There is almost no information available on this topic (or atleast we can't find it). We already checked the cern-website about this subject and the support forums.

Does anyone has a good example or a website where we can find more information on this topic?

Thanks in advance.

With kind regards,
Bob

Update:
We found out that by including cling/Interpreter/Interpreter.h we could talk to the interpreter. We haven't got it compiling yet but we are getting closer. For more info, check: http://www.youtube.com/watch?v=wZZdDhf2wDw

like image 203
Bob Avatar asked Mar 23 '23 17:03

Bob


1 Answers

Sorry for the late answer. If you want to embed the interpreter in your program, you will have to link against libCling or you should build so. On the prompt, you can do:

#include "cling/Interpreter/Interpreter.h"

Then on the prompt you could use the gCling variable which is a reference to the interpreter itself. For example:

gCling->process("somecodehere")

A good start to explore cling is its test suite and doxygen documentation. The mailing list [email protected] is also a good idea.

like image 87
vvassilev Avatar answered Apr 02 '23 07:04

vvassilev