Handmade Hero»Forums»Code
Stefan Koch
22 posts
cling c++ interpreter
I just wanted to mention, that there is a c++ "interpreter" (it's a jit really) it is called cling.
to get it, look at http://root.cern.ch/drupal/content/cling-build-instructions

If requested I will build a windows binary and load it up to some webspace
Awais Ahmad
11 posts
cling c++ interpreter
The idea seems pretty cool and I would like to use it. I wonder however how much work would you have to put into it?
Stefan Koch
22 posts
cling c++ interpreter
almost no work.
If clang is compiling then cling is too.
Awais Ahmad
11 posts
cling c++ interpreter
If its not too much work I would like to have a build, it would be interesting to be able to test out code this way. It would be interesting to play with! :)
Stefan Koch
22 posts
cling c++ interpreter
Edited by Stefan Koch on
Alright. I ran into problems I have to hack windows support for cling together.
It should not be too hard. I am expecting results in 2-7 days.

EDIT
Solved parts of it!

cling_x86_MSVC_12.zip
Stefan Koch
22 posts
cling c++ interpreter
Edited by Stefan Koch on
please remember. I had to hack the source to get it to compile.
Expect hiccups!
The ValuePrinter of cling will not work properly.
There could be problems with destructors.
perhaps more ...

Anyway, Enjoy cling :)

P.S. please tell me if you are haveing problems. Maybe I fix a few of them.
Awais Ahmad
11 posts
cling c++ interpreter
TY :) I will try and test it as soon as I get back home :) Will let you know tomorrow how the test goes!
Stefan Koch
22 posts
cling c++ interpreter
Edited by Stefan Koch on
has anyone tried cling yet ?
I usually don't work on windows so I do not have many chances to catch bugs :)

A little feedback would be very welcome.
Awais Ahmad
11 posts
cling c++ interpreter
Hi

Sorry for my late reply. I have been sick lately and havent had the time to fully investigate the issue. When I try to run cling I get the following error:

C:\Users\Awais\Downloads\cling_x86_MSVC_12>cling
ERROR in cling::CIFactory::createCI():
resource directory C:\Users\Awais\Downloads\lib\clang\3.6.0 not found!
input_line_3:1:10: fatal error: 'cling/Interpreter/RuntimeUniverse.h' file not found

#include "cling/Interpreter/RuntimeUniverse.h"
^
Do I have to download clang or something ?

Best Regards
Awais
Stefan Koch
22 posts
cling c++ interpreter
This file should be in the zip package.
did you extract it all into one directory ?
(while preserving the directory structure ?)
also you need to invoke it in the directory where extracted it, OR add the directory to your include-paths
Awais Ahmad
11 posts
cling c++ interpreter
Edited by Awais Ahmad on Reason: formatting the dir struct
Yes, I extracted and ran from the place where it was extracted to. The files are actually there in the correct place, except that the dir structure looks like where "." is the folder I am running from.
.
└───include └───cling └───Interpreter

It works when I move the cling folder a step up and I can do some basic stuff like _cprintf(), variable assignment but trying to work with iostream has not been possible as of yet. This is how it looks like when the cling folder is one step up in the dir struct.


C:\Users\Awais\Downloads\cling_x86_MSVC_12>cling.exe
ERROR in cling::CIFactory::createCI():
resource directory C:\Users\Awais\Downloads\lib\clang\3.6.0 not found!
In file included from input_line_3:1:
./cling/Interpreter/RuntimeUniverse.h:26:10: warning: #include resolved using
non-portable MSVC search rules as: ./cling/Interpreter/RuntimeException.h
[-Wmsvc-include]
#include "cling/Interpreter/RuntimeException.h"
^
Stefan Koch
22 posts
cling c++ interpreter
oh yeah for c++ stuff you need more headers