Embedded Cling - Windows 64 Runtime Error

Hello Everyone,

I am embedding cling in a Visual Studio 2015 project.

As a precursor I built cling by using the following checkout procedure:

git clone htttp://root.cern.ch/git/llvm.git src
cd src
git checkout cling-patches
cd tools
git clone http://root.cern.ch/git/cling.git
git clone http://root.cern.ch/git/clang.git
cd clang
git checkout cling-patches

I then maintain 3 separate build and install trees corresponding to Debug, Release, and RelWithDebInfo.

Generally my program works and I can create an interpreter and call declare(), process(), execute() etc…

However I run into issues when I:

  1. Use declare to declare the following class:

class BigClass
{
public:
BigClass()
{
printf(“hi”);
}
~BigClass(){}
};

  1. interp->execute(“BigClass* bgClass = new BigClass();”);

I get the following output in debug build (linking against debug build of cling):

IncrementalExecutor::executeFunction: symbol ‘cling_runtime_internal_throwIfInvalidPointer’ unresolved while linking [cling interface function]!
You are probably missing the definition of cling_runtime_internal_throwIfInvalidPointer
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol ‘??3@YAXPEAXHPEBDH@Z’ unresolved while linking [cling interface function]!
You are probably missing the definition of void __cdecl operator delete(void * __ptr64,int,char const * __ptr64,int)
Maybe you need to load the corresponding shared library?

and the following output in release build (linking against release build of cling):

IncrementalExecutor::executeFunction: symbol ‘cling_runtime_internal_throwIfInvalidPointer’ unresolved while linking [cling interface function]!
You are probably missing the definition of cling_runtime_internal_throwIfInvalidPointer
Maybe you need to load the corresponding shared library?

I should note - using cling.exe in this scenario does work:

  1. .L BigClass.h
  2. BigClass* bgClass = new BigClass();

Any help is appreciated!

Aha I was using interp->process(“#include ”); instead of interp->declare(“#include ”);
before running the instantiation. From what I understand from the documentation these should have the same effect right?

///\brief Compiles the given input.
///
/// This interface helps to run everything that cling can run. From
> /// declaring header files to running or evaluating single statements.
/// Note that this should be used when there is no idea of what kind of
/// input is going to be processed. Otherwise if is known, for example
/// only header files are going to be processed it is much faster to run the
/// specific interface for doing that - in the particular case - declare().
///
///\param[in] input - The input to be compiled.
///\param[in,out] V - The result of the evaluation of the input. Must be
/// initialized to point to the return value’s location if the
/// expression result is an aggregate.
///\param[out] T - The cling::Transaction of the compiled input.
///\param[in] disableValuePrinting - Whether to echo the expression result.
///
///\returns Whether the operation was fully successful.
///
CompilationResult process(const std::string& input, Value* V = 0,
Transaction** T = 0,
bool disableValuePrinting = false);

When we run the demo: cling/tools/demo/cling-demo.cpp at master · root-project/cling · GitHub we get the following runtime errors:

IncrementalExecutor::executeFunction: symbol ‘?setValueNoAlloc@internal@runtime@cling@@YAXPEAX00D_K@Z’ unresolved while linking [cling interface function]!
You are probably missing the definition of void __cdecl cling::runtime::internal::setValueNoAlloc(void * __ptr64,void * __ptr64,void * __ptr64,char,unsigned __int64)
Maybe you need to load the corresponding shared library?
aGlobal is 274710484583063
IncrementalExecutor::executeFunction: symbol ‘?setValueNoAlloc@internal@runtime@cling@@YAXPEAX00DM@Z’ unresolved while linking [cling interface function]!
You are probably missing the definition of void __cdecl cling::runtime::internal::setValueNoAlloc(void * __ptr64,void * __ptr64,void * __ptr64,char,float)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol ‘?getAnotherGlobal@@YAMXZ’ unresolved while linking [cling interface function]!
You are probably missing the definition of float __cdecl getAnotherGlobal(void)
Maybe you need to load the corresponding shared library?
getAnotherGlobal() returned 5.11364e-36
IncrementalExecutor::executeFunction: symbol ‘?setValueNoAlloc@internal@runtime@cling@@YAXPEAX00DM@Z’ unresolved while linking [cling interface function]!
You are probably missing the definition of void __cdecl cling::runtime::internal::setValueNoAlloc(void * __ptr64,void * __ptr64,void * __ptr64,char,float)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol ‘?getAnotherGlobal@@YAMXZ’ unresolved while linking [cling interface function]!
You are probably missing the definition of float __cdecl getAnotherGlobal(void)
Maybe you need to load the corresponding shared library?
getAnotherGlobal() returned 5.11364e-36
IncrementalExecutor::executeFunction: symbol ‘?setAnotherGlobal@@YAXM@Z’ unresolved while linking [cling interface function]!
You are probably missing the definition of void __cdecl setAnotherGlobal(float)
Maybe you need to load the corresponding shared library?
IncrementalExecutor::executeFunction: symbol ‘?getAnotherGlobal@@YAMXZ’ unresolved while linking [cling interface function]!
You are probably missing the definition of float __cdecl getAnotherGlobal(void)
Maybe you need to load the corresponding shared library?
getAnotherGlobal() returned 1
7 * 8 = 56
The square of 17 is 289

Is this known to be the case currently on windows builds? Or is there potentially a library we are missing? when linking our application against cling we do have to disable libcling and libjupiter in cling’s cmake files.

We dont have any issues (apart from virtual function inheritance) with cling.exe.

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