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
C# and C++ Interoperability - cho-dotnetnew
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Akiko Kawai
May 29, 2026
Programming
590
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
C# and C++ Interoperability - cho-dotnetnew
2026/5/29 超dotnetnew
「C++とC#の相互運用」遥佐保
Akiko Kawai
May 29, 2026
More Decks by Akiko Kawai
See All by Akiko Kawai
Unity Scripting Backend - C++breaktime 2026 Summer
harukasao
0
120
How to call c# from c++ - meetup app osaka@10
harukasao
0
57
VCpp Link and Library - C++ breaktime 2025 Summer
harukasao
0
330
Coding Experience Cpp vs Csharp - meetup app osaka@9
harukasao
0
1.3k
Selected MAUI Blazor - meetup app osaka@8
harukasao
0
180
Try C++ module! - meetup app osaka@5
harukasao
0
520
シミュレーター制作の感想/ Tried developing Simulator at .NET Lab 201910
harukasao
0
120
NimTorchの紹介 / Introduce NimTorch meetup app osaka @3
harukasao
0
920
std::optionalの使い方 / how to use optional nakamecpp_13
harukasao
0
2.7k
Other Decks in Programming
See All in Programming
信頼性の目標を誰も求めてない
shubox
0
480
T3DD26: From RAGs to Riches
martinhelmich
0
140
レビュー履歴をAIに食わせて、 Compose移行を加速するs
shihochan
0
260
Oxlintはいいぞ(続)
yug1224
1
540
Pythonの実行はどこまで賢くなったのか? CPythonとPyPyから見る最適化のしくみ
curekoshimizu
4
2.7k
Seeing Through Serverless: Observability for AWS Lambda with ADOT and CloudWatch Application Signals
seike460
PRO
1
120
30年振りにコンパイラの定数整数除算を改善した
herumi
9
4.4k
AWS Step Functions 大規模並列の壁を越える / jaws-sonic-2026-niigata-step-functions
kasacchiful
PRO
0
300
DroidKaigi 2026 「個人開発という実験場: Android エンジニアが手にする4つの自由」
slashnephy
0
200
AIは賢い。でも実行環境は? CLIおじさんがAI時代に伝えたいこと ~ CLIおじさんがAI時代に伝えたいこと ~
curekoshimizu
1
140
AI時代に学ぶ 好きなルール 嫌いなルール Linter編
shorty5121
0
800
Claude Codeを組織的に動かして月400PRを実現した話
happy_ryo
0
250
Featured
See All Featured
30 Presentation Tips
portentint
PRO
1
390
Tell your own story through comics
letsgokoyo
1
1.1k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.9k
Discover your Explorer Soul
emna__ayadi
2
1.3k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
400
4 Signs Your Business is Dying
shpigford
187
23k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.2k
The Curse of the Amulet
leimatthew05
2
14k
Facilitating Awesome Meetings
lara
57
7.1k
WENDY [Excerpt]
tessaabrams
12
39k
Fireside Chat
paigeccino
42
4k
Transcript
None
None
None
None
Type C# → C++(序章) COM系 COM Interop(RCW) CLI系 C++/CLIラッパー Export系
P/Invoke (DLLImport,LibraryImport) https://learn.microsoft.com/ja-jp/dotnet/standard/native-interop/runtime-callable-wrapper RCW C# Client COM Object C++/CLI 自作Wrapper (/clr) C# Client Native Class/DLL C# Client Marshal (auto- generated) Native DLL CLRに組み込まれている DllImport 実行時 LibraryImportビルド時
None
え?なんで? さっきの逆でしょ? C#のメモリ先に飛ん でけばいいやん?
None
Type C++ → C# COM系 COM Interop(CCW) Windows only 超Legacy
マーシャリング コスト大 CLI系 /clr 化 つまり /clr option Windows only Legacy C++/CLIブリッジDLL CCW C# Object COM Client Native Class/DLLのCLR化 (/clr) IJW(It Just Works) Thunk using VTableFixup C++/CLI 自作ブリッジ DLL C# Object Native Class/DLL C# Object
Type C++ → C# Export 系 DllExport (~.NET Framework) Windows
only 超Legacy NativeAOT (.NET 7+) +[UnmanagedCallersOnly] ホットリロード未対応, ランタイムは固定, 手動でC ABIを解決, ライブラリ抱き込み Cross- platform Build後にToolでC# DLLのILを書き換え パッチDLL(純粋なIL) C# Object using VTableFixup Native Class/DLL AOTコンパイラが C#コードをNativeDLLへ Native Class/DLL C# Native
Type C++ → C# Hosting 系 CLR Hosting APIはCOM Interface,
CCWなし Windows only Hostfxr (.NET Core 3.0+) +[UnmanagedCallersOnly] (.NET 5+) 直接C API使う Cross-platform C++ Process CLR Runtime C# Managed Heap Native Class/DLL C++ Process Core CLR Runtime C# Managed Heap Native Class/DLL
まとめ
Type C# → C++ C++ → C# COM系 COM Interop(RCW)
COM Interop(CCW) CLI系 C++/CLIラッパー /clr, C++/CLIブリッジDLL Export系 P/Invoke (DLLImport,LibraryImport) DllExport, NativeAOT+[UnmanagedCallersOnly] Hosting系 なし (C++は既にNativeなので Runtime不要) CLR Hosting, hostfxr+[UnmanagedCallersOnly]