Skip to content
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

Is there any support for Qt? #5

Closed
ShalokShalom opened this issue Jul 28, 2017 · 8 comments

Comments

Projects
None yet
2 participants
@ShalokShalom
Copy link

commented Jul 28, 2017

Can I use Qt libraries with this? Like QML/Qt Quick

@luc-tielen

This comment has been minimized.

Copy link
Owner

commented Jul 28, 2017

This should be possible, basically Cure sets up a port to an external OS process (in your case C++ app).
All data is forwarded back and forth with stdio between Elixir and C++ app.

So in your C++ application you can use any libs as long as you can get it to compile/link 😄.
Cure can generate a standard Makefile with mix cure.bootstrap, but as long as you pass same flags as in the Makefile to your build system, it should compile.
The mix 'compile.cure' task expects a Makefile with an 'all' target in c_src directory, so if that calls into Qt build system it should work.

If you want to use a GUI, you probably will have to create a separate thread (QThread?) on C++ side so you have 1 thread for sending data back and forth to Elixir, and 1 for interacting with GUI.

Let me know if you need any further help with this. (also interested into what you want to build with it 😄)

@ShalokShalom

This comment has been minimized.

Copy link
Author

commented Jul 28, 2017

Hi there and thanks for your reply. I opened up a thread on the Elixir forums: https://elixirforum.com/t/qt-for-elixir/7290

Do you think, Cure offers some benefits in comparison with the port mapping in native OTP/BEAM?

@luc-tielen

This comment has been minimized.

Copy link
Owner

commented Jul 28, 2017

I read your post on the forums.
The main reason I wrote this library was for boilerplate removal and to automate some things (such as hooking C or C++ to Elixir) by putting them into mix tasks, underneath it uses normal Erlang ports (like the other poster said).
It won't help you with writing the actual (multithreaded) C/C++ application though, sadly 😞 ..

@ShalokShalom

This comment has been minimized.

Copy link
Author

commented Jul 29, 2017

So I can't use Elixir to write the backend and QML for the front end?
In which way is there Qt support then?

@luc-tielen

This comment has been minimized.

Copy link
Owner

commented Jul 29, 2017

Cure helps in removing quite a bit of boilerplate that is used to transmit the data back and forth between 2 OS processes (e.g. Elixir and C++) and also for integrating C/C++ code with your Elixir code.

Once the data is at the other side, the programmer will have to do all the rest and do something with the data, for example display it in the GUI..
So yes, you can use Elixir for a backend, and C++/Qt as a GUI/frontend, but you will still need to get the data where it needs to be in your application, can't help you with that :)

@ShalokShalom

This comment has been minimized.

Copy link
Author

commented Jul 29, 2017

So it makes more sense to use Elixir is some specific cases, where C++ is unsuited?

@luc-tielen

This comment has been minimized.

Copy link
Owner

commented Jul 29, 2017

Yes ofcourse, just like normal tools such as a hammer, screw driver. Each language has it's own strengths and weaknesses, it's up to the programmer to get the most out of it.

C++: great for number crunching, computation heavy applications
Elixir: great for backend stuff, applications that can benefit from concurrency, possibly distributed over multiple computers, ...

Erlang/Elixir ports are a great way to call out into other languages to make use of their strenghts so we are not limited to just the capabilities of this language 😄.

@ShalokShalom

This comment has been minimized.

Copy link
Author

commented Jul 29, 2017

Thanks a lot for your kind help. Here is, for what i hope currently:
elixirscript/elixirscript#340

In case, somebody reads that and likes to follow the progress....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.