Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
【Rust × C++】 夢の共演を試した話
Search
lemolatoon
August 10, 2023
Programming
1
1.4k
【Rust × C++】 夢の共演を試した話
2023 セキュリティ・キャンプLT会で話した内容です。
lemolatoon
August 10, 2023
Tweet
Share
More Decks by lemolatoon
See All by lemolatoon
no_stdでもasyncしたい
lemolatoon
0
220
AI系サービスに代表されるAPIについて
lemolatoon
0
60
Rustの手続きマクロで黒魔術入門
lemolatoon
2
880
Other Decks in Programming
See All in Programming
Milestoner
bkuhlmann
1
410
"config" ってなんだ? / What is "config"?
okashoi
0
250
Introducing Kotlin Multiplatform in an existing mobile app - Workshop Edition | AndroidMakers Paris
prof18
0
140
Three ways to use AI on Android: The Good, the Bad and the Ugly
marxallski
0
100
ゆるい個人開発のススメ
kuroppe1819
10
1k
VS Code をプロダクトにどう取り込むか
onomax
1
650
StoreKit2によるiOSのアプリ内課金のリニューアル
kangnux
0
120
Go製Webアプリケーションのエラーとの向き合い方大全、あるいはやっぱりスタックトレース欲しいやん / Kyoto.go #50
utgwkk
6
1.7k
敵対的ポイフル
futabato
0
130
Let's learn code review
riofujimon
2
570
スクラムガイドのスプリントレトロスペクティブを改めて読みかえしてみた / Re-reading the Sprint Retrospective Section in the Scrum Guide
mackey0225
3
480
TCAとKMPを用いた新規動画配信アプリ 「ABEMA Live」の設計
tomu28
2
130
Featured
See All Featured
It's Worth the Effort
3n
180
27k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
21
1.4k
The Art of Programming - Codeland 2020
erikaheidi
43
12k
Clear Off the Table
cherdarchuk
85
310k
The Pragmatic Product Professional
lauravandoore
26
5.8k
Pencils Down: Stop Designing & Start Developing
hursman
117
11k
Code Review Best Practice
trishagee
56
15k
Building a Scalable Design System with Sketch
lauravandoore
457
32k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
11
1k
Design by the Numbers
sachag
274
18k
Reflections from 52 weeks, 52 projects
jeffersonlam
345
19k
How to name files
jennybc
65
93k
Transcript
【Rust × C++】 夢の共演を試した話 Y1 OS自作ゼミ lemolatoon
自己紹介 • 名前: lemolatoon • twitter( X ) や github
は lemolatoon • 情報系の学科の大学2年生 • 普段は Rust を触っていることが多いです。
Rust × C++ !? Rust × C の場合 • Rustはシステムプログラミング言語で
C言語の関数などは簡単に呼ぶことができる。 • C言語は、いろいろな言語の間の共通言語のような感じでいろいろな言語から呼べるような仕組みがあ る。 Rust × C++ の場合 • 共通言語であるC言語からC++のクラスなどを使うのが難しいように、 RustからC++を使うのは難しい
CXX crate CXX crateはRust, C++どうしを舞台裏でCに訳してくれる。 現実の翻訳家のようなもの。 * Rustではcrateというものがあり、他言語でいうところのライブラリのようなものである。 * 画像の出典:
cxx.rs
具体例 ← C++のクラスの実装 ↓Rustのライブラリのノリをつくる部分
具体例 Rust から C++ が呼べた! * https://github.com/lemolatoon/cxx-example
舞台裏で作られた”のり”の部分 ↑C++側 Rust側→
実際に使われた例 • autocxx ◦ CXX crateをさらにwrapしたcrate • chromium ◦ https://source.chromium.org/chromium/chromium/src/+/main:third_party/rust/serde_json_
lenient/v0_1/wrapper/lib.rs ◦ https://github.com/chromium/chromium/blob/4184e2582e2a94f607c7eec562502dcd370 d5769/docs/rust.md ◦ 実際にchromiumのソースコード内部で使われている!
None
ありがとうございました。 twitter: @lemolatoon1 github: lemolatoon https://github.com/lemolatoon/cxx-example