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
Akiko Kawai
May 29, 2026
Programming
580
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
94
How to call c# from c++ - meetup app osaka@10
harukasao
0
53
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
170
Try C++ module! - meetup app osaka@5
harukasao
0
510
シミュレーター制作の感想/ 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
PHP に部分適用が来るぞ!……ところで何それ?おいしいの? #phpcon / phpcon-2026
shogogg
0
610
TSX の <Hoge<Fuga>> という構文に驚いた話 / tsx-type-argument-syntax
kanaru0928
0
210
Apache Hive: そしてCloud Native Lakehouseへ
okumin
1
220
Japan Community Day at Kubecon + CloudNativeCon Japan 2026: Learning Container Privilege Control by Building My Own Low-Level Container Runtime
ternbusty
1
150
仕様書を書く前にハーネスを作る - Agent Native開発は「探索を速く、判定を固く」
gotalab555
4
1.6k
jsmini JavaScript Engine を作ってみた話
yosuke_furukawa
PRO
0
300
人間の目はかわらない、だからJPEGは30年もつ
yuzneri
12
18k
AI Engineeringは、AIプロダクトだけのものか? 〜AIがソフトウェアを作る時代の新しい当たり前〜 / No AI in your product. AI Engineering in your development.
rkaga
4
390
型も通る、synthも通る、それでも危ない 〜AIのCDKの権限とコストを機械で検証する〜 / It Passes Type Checks, It Passes Synth Checks, but It’s Still Risky — Automatically Verifying Permissions and Costs in AI’s CDK —
seike460
PRO
1
540
GDG Korea Android: 2026 I/O Extended ~ What's new in Android development tools
pluu
0
220
運用ダッシュボードの設計を誰も教えてくれないのだけどみなさんどうしてるんですか? - チームに監視するという文化を根付かせるための第一歩を踏みたい -
satoshi256kbyte
1
100
ドリフトを絶対に許さない(?)CDK運用 / CDK Ops with Zero Tolerance for Drifts (?)
akihisaikeda
1
180
Featured
See All Featured
From π to Pie charts
rasagy
0
270
Highjacked: Video Game Concept Design
rkendrick25
PRO
1
430
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.8k
Fireside Chat
paigeccino
42
4k
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.5k
GraphQLとの向き合い方2022年版
quramy
50
15k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
470
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
200
How to build a perfect <img>
jonoalderson
1
5.9k
New Earth Scene 8
popppiees
3
2.5k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
360
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]