Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Emscripten - compile your C/C++ to javascript
Search
thekk
November 03, 2015
Technology
0
50
Emscripten - compile your C/C++ to javascript
Just like magic, but in technology way.
thekk
November 03, 2015
Tweet
Share
More Decks by thekk
See All by thekk
i3 tiling window manager
thekk
0
120
做遊戲,從SDL開始
thekk
0
330
版本控制&Git
thekk
0
70
GC project outline slider
thekk
0
59
Other Decks in Technology
See All in Technology
ウェルネス SaaS × AI、1,000万ユーザーを支える 業界特化 AI プロダクト開発への道のり
hacomono
PRO
0
320
MLflowダイエット大作戦
lycorptech_jp
PRO
1
160
Power of Kiro : あなたの㌔はパワステ搭載ですか?
r3_yamauchi
PRO
0
200
AI-DLCを現場にインストールしてみた:プロトタイプ開発で分かったこと・やめたこと
recruitengineers
PRO
2
200
AIエージェント開発と活用を加速するワークフロー自動生成への挑戦
shibuiwilliam
4
730
Fashion×AI「似合う」を届けるためのWEARのAI戦略
zozotech
PRO
2
1.1k
SQLだけでマイグレーションしたい!
makki_d
0
1.2k
Building Serverless AI Memory with Mastra × AWS
vvatanabe
0
100
AI との良い付き合い方を僕らは誰も知らない
asei
0
200
普段使ってるClaude Skillsの紹介(by Notebooklm)
zerebom
5
1.6k
Strands Agents × インタリーブ思考 で変わるAIエージェント設計 / Strands Agents x Interleaved Thinking AI Agents
takanorig
4
1.5k
20251222_サンフランシスコサバイバル術
ponponmikankan
2
130
Featured
See All Featured
Building Adaptive Systems
keathley
44
2.9k
GraphQLの誤解/rethinking-graphql
sonatard
73
11k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
67
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.7k
B2B Lead Gen: Tactics, Traps & Triumph
marketingsoph
0
31
The Illustrated Children's Guide to Kubernetes
chrisshort
51
51k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
54k
Git: the NoSQL Database
bkeepers
PRO
432
66k
Leading Effective Engineering Teams in the AI Era
addyosmani
9
1.4k
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
140
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