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
Autocxx -RustからC++を安全かつ楽に-
Search
minami
September 02, 2020
Programming
1.5k
2
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Autocxx -RustからC++を安全かつ楽に-
下町.rs #3
minami
September 02, 2020
More Decks by minami
See All by minami
Account/Balanceモデルのシャーディングと課題点
minaminao
1
820
Rustで始める競技プログラミング
minaminao
0
340
Other Decks in Programming
See All in Programming
AIに “答え“を書かせるのを やめてみた
___akari11
0
120
AI が書く Go コードの品質を劇的に向上させる Linter: “declscope”
mpyw
0
490
JAWS-UG 東京支部が始める、JAWS-UG支部コラボ / JAWS-UG lunchtime LT Collaboration
y0hgi
0
250
プロダクトコードからライブラリの境界を見つける
elmetal
PRO
0
110
見えないものを探る要求要件定義に必要な基本的思考 / invisible-requirement-thinking
minodriven
15
8.3k
動作中のプログラムの中身をリアルタイムに覗く / Realtime Debugger for CSharp with Roslyn
prota
1
1.9k
dotNET_vulnclicker_intro.pdf
deka_morita
0
140
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
650
最近”作らせてる” ローカルAIアプリの話
akit37
0
460
IBM Bob Dojo #1 仕様駆動開発入門
oniak3ibm
PRO
0
380
全ての永続トークンを、生まれる前に消し去りたい!
sylph01
1
310
Apple Intelligence を用いた個人情報誤送信防止、及びユーザーリクエスト体験の改善について
yukiny
0
330
Featured
See All Featured
A Modern Web Designer's Workflow
chriscoyier
699
190k
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
260
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
68
59k
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
460
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
980
Large-scale JavaScript Application Architecture
addyosmani
516
110k
My Coaching Mixtape
mlcsv
0
350
Understanding Cognitive Biases in Performance Measurement
bluesmoon
32
3k
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.3k
Art, The Web, and Tiny UX
lynnandtonic
304
22k
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
1
450
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
350
Transcript
Autocxx - RustからC++を安全かつ楽に - minaminao @vinami - 下町.rs #3 1
自己紹介 • 岡南 直哉 (@vinami) • LayerX Labs リサーチャー ◦
ブロックチェーンのスケーラビリティ、 特にシャーディング • 未踏2020で『Shargri-La』開発中 ◦ シャーディングプロトコル開発を支援 するソフトウェア ◦ Rustです 2
Autocxxとは? 3
4 RustからC++を安全かつ楽に呼ぶツール https://github.com/google/autocxx
とりあえず試してみる(定義側) Autocxxとは? 5 再帰で階乗
とりあえず試してみる(呼び出し側) Autocxxとは? 6
とりあえず試してみる(実行) Autocxxとは? 7 できた!簡単 Source: https://github.com/minaminao/autocxx/tree/shitamachi/demo
仕組み 8
三段階の Procedural macro 仕組み 9 1. bindgen でバインディングを生成 2. それを解釈し
cxx::bridge に適したバインディングへ変換 3. cxx::bridge を実行
1. bindgen でバインディングを生成 仕組み 10 • bindgen (https://github.com/rust-lang/rust-bindgen) ◦ C(C++)のヘッダファイルからRust
FFIバインディングを自動 的に生成してくれるツール
2. cxx::bridge に適したバインディングへ変換 仕組み 11 • CXX (https://github.com/dtolnay/cxx) ◦ RustからC++をunsafeなしに呼び出せるツール
◦ C++からRustも可能
開発状況 12
対応済み 開発状況 13 • Primitives (u8, etc.) • Plain-old-data structs
• std::unique_ptr of POD • std::unique_ptr of std::string • Reference to POD • Reference to std::string
未対応 開発状況 14 • std::unique_ptr of opaque types • Methods
• #defines • Constants • Enums • Structs containing UniquePtr • Structs containing strings • make_unique
RustからC++を呼ぶ重要性 15
例: Chromium RustからC++を呼ぶ重要性 16 • 2015年度以降のインパクト高のバグの内訳 https://www.chromium.org/Home/chromium-security/memory-safety
例: Chromium RustからC++を呼ぶ重要性 17 https://www.chromium.org/Home/chromium-security/memory-safety/rust-and-c-interoperability
例: Chromium RustからC++を呼ぶ重要性 18 • ChromiumのコアはC++ • RustからC++の呼び出しが重要視されている https://www.chromium.org/Home/chromium-security/memory-safety
まとめ 19
20 • AutocxxはRustからC++を安全かつ楽に呼ぶツール ◦ 絶賛開発中 ◦ C++ベースのプロジェクトは、RustからC++を呼ぶ機能を 求めており、注目されている まとめ