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
Polars入門
daikikatsuragawa
1
170
『Railsオワコン』と言われる時代に、なぜブルーモ証券はRailsを選ぶのか
free_world21
1
360
try! Swift Tokyo 初参加報告LT
hinakko2
0
240
Node.js v22 で変わること
yosuke_furukawa
PRO
11
3.9k
Let's learn code review
riofujimon
2
580
Milestoner
bkuhlmann
1
410
Anthropic Cookbook のおすすめレシピ
schroneko
7
1.1k
禅の心を手に入れよ
eltociear
1
360
Deep Dive into React Stream/Serialize
mugi_uno
3
680
雑に思考を整理する技術と効能
konifar
63
30k
CDKコントリビュートの最初の壁を越えよう! -簡単issueの見つけ方-
badmintoncryer
3
210
VS Code をプロダクトにどう取り込むか
onomax
1
710
Featured
See All Featured
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
13
8.3k
Reflections from 52 weeks, 52 projects
jeffersonlam
345
19k
The Illustrated Children's Guide to Kubernetes
chrisshort
32
46k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
123
39k
Bootstrapping a Software Product
garrettdimon
PRO
302
110k
5 minutes of I Can Smell Your CMS
philhawksworth
199
19k
Build your cross-platform service in a week with App Engine
jlugia
226
17k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
22
1.6k
Building Applications with DynamoDB
mza
88
5.6k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
20
1.6k
The Cult of Friendly URLs
andyhume
74
5.7k
What's in a price? How to price your products and services
michaelherold
238
11k
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