-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cling: experiments and exploration #49
Comments
I can also report that this opens a window and draws a red background:
The cling terminal hangs---Foo().start() blocks. And, the terminal comes back only after we quit the app. But (!) the app does not really quit. We get the pinwheel and the window will not disappear. |
cling is at the heart of CERN's data analysis framework, ROOT: https://root.cern.ch/. ROOT is sort of like the Python Notebook stack or MATLAB, but the underlying language is C++. I am not sure how many scientists use ROOT rather than MATLAB, python, R, Julia or some other stack.
|
Can we use a thread to make an app start non-blocking? I tried these two methods: cling -std=c++14
****************** CLING ******************
* Type C++ code and press enter to run it *
* Type .q to exit *
*******************************************
[cling]$ #include "prelude.h"
[cling]$ #include <thread>
[cling]$ struct Foo : al::App { void onDraw(al::Graphics& g) override { g.clear(1, 0, 0); }};
[cling]$ std::thread t([]{ Foo().start(); }); // CRASH cling -std=c++14
****************** CLING ******************
* Type C++ code and press enter to run it *
* Type .q to exit *
*******************************************
[cling]$ #include "prelude.h"
[cling]$ #include <thread>
[cling]$ struct Foo : al::App { void onDraw(al::Graphics& g) override { g.clear(1, 0, 0); }};
[cling]$ Foo foo;
[cling]$ std::thread t([&]{ foo.start(); }); // CRASH The crash report looked like this:
|
We have already worked on this a bit. I thought I would start a record of the journey and a conversation.
For many reasons, it would be nice to interact with our framework from a REPL. cling (https://root.cern/cling/) offers an opportunity for that.
Thank you Andrés for your work on compiling shared libraries. This allows us to link in cling because (at the moment) cling only supports dynamic linking to shared libraries.
Here is the state of things on macOS 10.15.7 on Intel x64:
I installed cling with
brew install cling
.I compiled AlloLib after configuring the CMakeLists.txt. I turned on building shared libraries:
Here is the contents of
prelude.h
:If someone could try Linux and report back, it would be appreciated.
cling binaries and supporting libraries are hard to come by for Windows. My attempts to build cling.exe ended in failure (so far). This GitHub repository has binaries that worked for me:
..but I would not ask others to trust the binaries of some random "author". If someone succeeds at building cling on windows or finds a reputable source of binaries, please report this. I will try to test on Windows with what I have.
The text was updated successfully, but these errors were encountered: