[cfe-dev] cling

Axel Naumann Axel.Naumann at cern.ch
Wed Jul 27 16:12:18 PDT 2011


Hi Argyrios,

On 07/27/2011 08:31 PM, Argyrios Kyrtzidis wrote:
> Technically it should be possible to have a static library in llvm
> bitcode and load that, is it something you guys can consider ?

Implemented. You can now do e.g.

$ cat test.cxx
#include <stdio.h>
void HELLO() { printf("HELLO!\n");}
$ clang -emit-llvm -c test.cxx  -o test.bc
$ cling -ltest.bc
$ void HELLO();
$ HELLO()
HELLO!

It simply uses the llvm::Linker - whatever that understands should now
be understood by cling.

Thanks for the suggestion!

Cheers, Axel.

>>
>>
>>>
>>> On Jul 25, 2011, at 15:28, Axel Naumann wrote:
>>>
>>>> Hi,
>>>>
>>>> As we announced before
>>>> <http://www.llvm.org/devmtg/2010-11/Naumann-Cling.pdf>, we (people from
>>>> CERN and Fermilab) are working on the C++ interpreter(*) cling
>>>> <http://cern.ch/cling> that's based on clang and llvm. This is in the
>>>> context of ROOT <http://root.cern.ch> and CINT
>>>> <http://root.cern.ch/cint>, our current C++ interpreter.
>>>>
>>>> We have gotten to a stage where we believe cling is actually useful: it
>>>> behaves like a regular interpreter!
>>>>
>>>> [cling]$ #include <cmath>
>>>> [cling]$ double x = std::sin(3.1)
>>>> (double) 4.158066e-02
>>>> [cling]$ .L libz
>>>> [cling]$ #include "zlib.h"
>>>> [cling]$ zlibVersion()
>>>> (const char * const) "1.2.3.4"
>>>>
>>>> or simply
>>>>
>>>> $ echo 'extern "C" const char* zlibVersion();
>>>> zlibVersion()' | cling -lz
>>>>
>>>> (const char * const) "1.2.3.4"
>>>>
>>>> and even
>>>>
>>>> $ cat t.cxx
>>>> #include "cling/Interpreter/Interpreter.h"
>>>> void t() {
>>>>  gCling->processLine("gCling->getVersion()");
>>>> }
>>>> $ cling
>>>> [cling]$ .x t.cxx
>>>> (const char * const) "$Id: Interpreter.cpp 40322 2011-07-21 14:20:14Z
>>>> axel $"
>>>>
>>>> We would like to know whether it's just us finding this spectacular :-)
>>>> or whether there is general interest. Our aim is to get it included in
>>>> the clang repository.
>>>>
>>>> For us, this is just the first step; we need to integrate it into the
>>>> rest of our software wildlife here at CERN, and we need to continue to
>>>> work on robustness and features, e.g. reloading of code. I.e. I expect
>>>> we will maintain and continue to develop it for years to come.
>>>>
>>>> Here is the code:
>>>> svn co http://root.cern.ch/svn/root/branches/dev/cling
>>>>
>>>> Let us know what you think!
>>>>
>>>> Best regards,
>>>> the cling team (Vassil, Philippe, Paul, Lukasz and Axel).
>>>>
>>>> (*) Yes, it's not an interpreter, it's really an incremental compiler
>>>> with an interactive shell with (eventually) features like automatic
>>>> library loading and late variable binding. But it smells like an
>>>> interpreter :-)
>>>> _______________________________________________
>>>> cfe-dev mailing list
>>>> cfe-dev at cs.uiuc.edu
>>>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>>>
>>>
>>
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
> 
> 



More information about the cfe-dev mailing list