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
[GoCon2026] When Goroutines Are Not Enough: Runtime Locality in High-Throughput Go
takehaya
6
2.2k
SREの越境 / SRE Collaboration
y0hgi
0
180
手動確認はもう限界 〜XCUITestでCustom URL Schemeの遷移を起動種別ごとに自動テストする〜 / Testing Custom URL Schemes with XCUITest
otouto
0
280
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
380
そのリトライ、死んだコネクションを使い回していませんか ── GoのHTTPクライアントとHTTP/2を実プロダクト障害から学び直す
myus4a
0
140
thread_parallel_with_free-threaded_Python_and_NumPy.pdf
riku_sakamoto
0
330
Go のフラットな パッケージに 「ファイル単位の private」を 〜Linter “declscope” を作った話〜
mpyw
0
320
C#の現在地 進化の歴史と、AI時代の.NET Everywhere
neuecc
0
340
AWS DevOps Agentで インシデント対応をAIに任せたい
honmarkhunt
7
2.9k
AHC070解法紹介
eijirou
0
120
FreeBSDでZabbixを動かす.pdf
kenkino
0
280
iOSDC Japan 2026 - Swiftで作って学ぼう!データベース自作入門
kaseken
2
160
Featured
See All Featured
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
3.1k
Jess Joyce - The Pitfalls of Following Frameworks
techseoconnect
PRO
1
410
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
800
VelocityConf: Rendering Performance Case Studies
addyosmani
331
25k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
6.2k
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.7k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
280
Chasing Engaging Ingredients in Design
codingconduct
0
310
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
2
2.1k
Scaling GitHub
holman
464
140k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
520
Principles of Awesome APIs and How to Build Them.
keavy
128
18k
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++を呼ぶ機能を 求めており、注目されている まとめ