Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Emscripten - compile your C/C++ to javascript
Search
thekk
November 03, 2015
Technology
65
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Emscripten - compile your C/C++ to javascript
Just like magic, but in technology way.
thekk
November 03, 2015
More Decks by thekk
See All by thekk
i3 tiling window manager
thekk
0
150
做遊戲,從SDL開始
thekk
0
360
版本控制&Git
thekk
0
90
GC project outline slider
thekk
0
69
Other Decks in Technology
See All in Technology
Kiro Crewをはじめよう
kizawa2020
1
160
hackers_champloo_2026_tidb
makocchi
0
160
Railsで挑む大量データ永続化 〜600億件を永続化するための設計とボトルネックとの戦い〜
occhi
1
580
Running Kotlin + Quarkus with Lambda
nealle
1
3.8k
実践! SRE × AI - ABEMA における AIOps -
tetsuya28
8
3.1k
AI × アーキテクト 第1・2章|生成AIの課題とアーキテクトの素養
daidaidai
0
170
Active Record Connection Adaptersにおける長年の課題に再び取り組む
yahonda
0
160
Post AI時代のリファクタリング実践記 / Refactoring in the post AI era
kaminashi
1
240
AIがコードを書く時代に、エンジニアは何で自分の価値を証明するのか / In an era where AI writes code how do engineers prove their value
carta_engineering
3
1.1k
Claude の新機能を、 出た日に触って社内に届けるまで
rfdnxbro
1
180
20261017福岡devIO 「AIは"良いダッシュボード"を作れるか?
jtakeda
0
160
コンテナ運用におけるネットワーク・コンテナコストの削減方法/How to Reduce Network and Container Costs in Container Operations
masakiokuda
1
230
Featured
See All Featured
Why You Should Never Use an ORM
jnunemaker
PRO
61
10k
Designing Experiences People Love
moore
143
24k
Ethics towards AI in product and experience design
skipperchong
2
430
End of SEO as We Know It (SMX Advanced Version)
ipullrank
3
4.4k
Claude Code のすすめ
schroneko
67
230k
What's in a price? How to price your products and services
michaelherold
247
13k
Code Reviewing Like a Champion
maltzj
529
40k
Intergalactic Javascript Robots from Outer Space
tanoku
273
28k
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
890
Designing Powerful Visuals for Engaging Learning
tmiket
1
610
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
120
120k
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
1
750
Transcript
Emscripten Compile your C/C++ code to javascript Actually, it's from
LLVM bitcode to javascript KK – Ying Reui Liang 2015/10/XX
What is Emscripten
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”
How it work
C/C++ source | clang/clang++ | V LLVM IR code |
Fastcomp (LLVM backend) | v Javascript code
em++ helloworld.cpp -c -o helloworld.bc
em++ helloworld.bc -o helloworld.html
Running in terminal Running in browser
Why
Large web applications Multi platform Performance critical library
Demonstration
Debugging
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
With -g4 you could even set breakpoints on C++ source
code inside browser devtool!
Porting your project
Since I don't have much experience I'll only talk a
little then skip the rest of them :P
- Main loop -
- Threading -
- Files/Assets -
Porting libraries
Currently, there's mainly three ways to port a library to
javascript using Emscripten
- 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
Write corresponding javascript code for functions in that library Like
library_sdl.js - The second one -
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 -
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 :)
End?
Welcome to special round!
Let's talk a little about WebAssembly
None
Q&A || Thanks
References
- http://kripken.github.io/emscripten-site/index.html - https://github.com/kripken/emscripten/blob/master/docs/paper.pdf - http://asmjs.org/ - https://github.com/WebAssembly/design