My Dark emscripten secrets

Joshua Koo, 23 feb 2015, talk.js

What is Emscripten?

Emscripten is an LLVM-to-JavaScript compiler. It takes LLVM bitcode - which can be generated from C/C++, using llvm-gcc (DragonEgg) or clang, or any other language that can be converted into LLVM - and compiles that into JavaScript, which can be run on the web (or anywhere else JavaScript can run).

Emscripten is an LLVM-based project that compiles C and C++ into highly-optimizable JavaScript in asm.js format. This lets you run C and C++ on the web at near-native speed, without plugins.


Some Inception

emcmake cmake .
emmake make
oh oh....

: (

make clean
git checkout
google errors


I struggle with Emscripten


  • these projects weren't trivial
  • maybe my Emscripten environment wasn't setup correctly
  • I wasn't familiar with C or C++ world
  • I wasn't familiar with the build systems

What went wrong?

study the requirements

Understand the source

Compile native

understand emscripten

Pick a simplier project


Dump the Build Systems

(pun intended)

emcc src/*.cpp -o hlslparser.js -s EXPORTED_FUNCTIONS="['_parseHLSL']" --bind -O3

GLSL Optimizer

Dump the Build Systems

Some other tips

1. Check for threads

2. Check File I/O

3. Consider bindings

What's Next?


The C* & JS world are not that far apart

I think emscripten is kinda awesome

There are more things out there

have fun!

I'm Joshua Koo
I work for Zopim, a Zendesk company
and organize creative coding meetups

twitter: @blurspline
facebook: fb
github: zz85


My forks


More Readings!


my dark emscripten secrets

By Joshua Koo

my dark emscripten secrets

my dark emscripten secrets

  • 19,658
Loading comments...

More from Joshua Koo