I am a subscriber to the Mozilla network newsletter and yesterday I got an email which was talking about WebAssembly. All out of pure coincidence, I was then talking with my friend Lefteris about my planning to start/resume writing C programs and maybe make some projects. I was telling him how much I like C and that someday I would learn C++ too in order to become a far better developer than I am now!
And then boom! The newsletter came at that moment as if the world was conspiring to get me all excited again about C programming language. You know the thing about it is that when you are a web developer JS is the king! How on earth could you possibly use C in web development?
And then there is this thing called WebAssembly! Damn!
Oh man! That is something completely out of this world! Without hesitation or even second thoughts I dove right into reading what someone can do with WA (I will call WebAssembly like this from here on, the name is too long to type all the time…).
Jumped to the official site. There is a section called getting started (as always) so I clicked there and started bashing in the commands. I will say to you right here that this took my forever to accomplish and nearly couldn’t do it at all!
I followed the instructions and had the following problems:
At the step where you type in this command:
./emsdk install sdk-incoming-64bit binaryen-master-64bit
and when the installer reached 96%, boom (at [96%] building clang tool):
tools/clang/tools/driver/CMakeFiles/clang.dir/build.make:229: recipe for target 'bin/clang-4.0' failed make: *** [bin/clang-4.0] Error 1
This guy saved my day, god bless him:
Well, what do you know! It was a memory RAM problem
Then I saw this and the installation crashed at 98%:
could not find ocaml (missing ocamlfind ocaml version ocaml stdlib path)
sudo apt-get install ocaml
This is the final outcome. For your information I do not have the slightest idea what this is: really, I am not joking.
It seems that this page prints to the browser the result or the printf command, that is Hello world! as you can see in the screenshot below!
I read about and saw some videos that you can use WA to build games for the browser in near native speeds, probably because of the speed of C language. But can you imagine the possibilities opening with this great work of Mozilla foundation? I will dig deeper into this new technology and I hope to come up with some pretty cool stuff to show you.
External resources: https://developer.mozilla.org/en-US/docs/WebAssembly