Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Emscripten - compile your C/C++ to javascript

thekk
November 03, 2015

Emscripten - compile your C/C++ to javascript

Just like magic, but in technology way.

thekk

November 03, 2015
Tweet

More Decks by thekk

Other Decks in Technology

Transcript

  1. Emscripten Compile your C/C++ code to javascript Actually, it's from

    LLVM bitcode to javascript KK – Ying Reui Liang 2015/10/XX
  2. It's a source to source compiler bases on LLVM Compile

    your C/C++ code into browser runnable javascript code Averagely, it's faster than handwrite code “Asm.js”
  3. C/C++ source | clang/clang++ | V LLVM IR code |

    Fastcomp (LLVM backend) | v Javascript code
  4. Why

  5. The native way Like we always do The browser way

    Compile your codebase with -gX (X is 1~4) Then debug them on the browser
  6. Since I don't have much experience I'll only talk a

    little then skip the rest of them :P
  7. - The first one - If you're using portable C/C++,

    or the dependencies you use had already been ported Just compile it Like jsoncpp, which relies on C++ std libraries
  8. If the library you want to port has friendly architecture

    for porting Use html5.h and other headers which Emscripten provide Treat Emscripten like another platform Like part of SDL2 does - The third one -
  9. If you want to add certain port to official repo

    of Emscripten... Check these out Or you can discuss with me, I just port SDL2_ttf last month :)