Skip to content

Instantly share code, notes, and snippets.

Last active Nov 13, 2019
What would you like to do?
Get arguments of a cling interpreter instance with reflection

To get the arguments of cling, which are passed on start, you can use the reflection feature of cling.

#include "cling/Interpreter/Interpreter.h"
#include "cling/Interpreter/InvocationOptions.h"

// gCling is an object of type cling::Interpreter
std::vector<const char*> remaining = gCling->getOptions().CompilerOpts.Remaining;

This comment has been minimized.

Copy link
Owner Author

@SimeonEhrig SimeonEhrig commented Nov 13, 2019

The solution for ROOT:

Workaround: use a cling build as the source for the necessary headers.

#pragma cling(add_include_path "/par/to/cling/install/include/")
#include "cling/Interpreter/Interpreter.h"

std::vector<const char*> remaining = cling::runtime::gCling->getOptions().CompilerOpts.Remaining;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment