3 ms·
As a relative web novice, WebAssembly continues to be an incredibly promising tool that has a lot of potential, but remains obtuse on how to actually get a comp
by aquova 6y ago
As a relative web novice, WebAssembly continues to be an incredibly promising tool that has a lot of potential, but remains obtuse on how to actually get a compiled .wasm binary to run properly in the browser. Most of the examples I've seen either are trivial programs like the one here, where they I still feel they pulled things like '_Z3addii' out of a hat. Alternatively, there are some articles that require you to delve into a pile of Node dependencies just to print out 'Hello World'.
I'm pleased to say I've finally uncovered the incantations to interface with a .wasm binary easily, but I was surprised how much digging it required, even with something as hyped as this. Perhaps I should write my own article on my findings.
- andrewf 6y ago_Z3addii looks like C++ name mangling - embedding parameter/return type information in the symbol (function) name, required to support C++ features on top of the linkers C++ grew up with. Declaring the function as `extern "C"` would turn the symbol name into "add", or maybe "_add". I suspect the author extracted the name from compiler-generated assembly or from a tool to list the symbols a .wasm exports.
- jesuisundev 6y agoYes, you need to read the article to confirm it. Nothing is hidden.