Can I somehow build webassembly code *without* the emscripten “glue”?

You can use emscripten to generate fairly minimal code output. Consider the following trivial file adder.c: int adder (int a, int b) { return a + b; } Compile it like this (requires a fairly recent emscripten): emcc -O2 -s WASM=1 -s SIDE_MODULE=1 -o adder.wasm To see what it generated, disassemble it to wast textual … Read more

Using Boost with Emscripten

I finally managed to compile the needed libraries with emscripten. Here are the steps I followed. Changes in emscripten Edit system/include/libcxx/climits to add the following definitions (see http://github.com/kripken/emscripten/issues/531): #ifndef CHAR_BIT # define CHAR_BIT __CHAR_BIT__ #endif #ifndef CHAR_MIN # define CHAR_MIN (-128) #endif #ifndef CHAR_MAX # define CHAR_MAX 127 #endif #ifndef SCHAR_MIN # define SCHAR_MIN (-128) … Read more

How to handle passing/returning array pointers to emscripten compiled code?

The expected format of Module.cwrap does allow for ‘array’s to be passed into the function, but will assert on result and fail if you attempt to return an array displayArrayA=Module.cwrap(‘displayArray’,’array’,[‘array’]) displayArrayA([1,2,3]) // Assertion failed: ccallFunc, fromC assert(type != ‘array’) A second restriction of this is that incoming arrays are expected to be byte arrays, meaning … Read more

Compiling Python to WebAssembly

WebAssembly vs asm.js First, let’s take a look how, in principle, WebAssembly is different from asm.js, and whether there’s potential to reuse existing knowledge and tooling. The following gives pretty good overview: Why create a new standard when there is already asm.js? What is the difference between asm.js and web assembly? Why WebAssembly is Faster … Read more

tech