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
560
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
81
How to call c# from c++ - meetup app osaka@10
harukasao
0
47
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
2年かけて Deno に DOMMatrix を実装した話 / How I implemented DOMMatrix in Deno over two years
petamoriken
0
180
PostgreSQL 18で考えるUUID主キー
kazuhiro1982
0
420
ルールを書いて終わらせないハーネスエンジニアリング
yug1224
4
1.8k
関数型プログラミングのメリットって何だろう?
wanko_it
0
200
ここ半年くらいでAIに作らせたR用ツール
eitsupi
0
310
Generative UI & AI-Assistants for Your Angular Solutions
manfredsteyer
PRO
1
230
AIが無かった頃の素敵な出会いの話
codmoninc
1
250
AI時代の仕事技芸論〜ソフトウェア開発で「遊ぶように働く」職人的熟達のすすめ(スクフェス仙台 2026バージョン)
kuranuki
0
730
吝嗇家のためのAI活用 / AI development for miser - ChatGPT + Issue Driven Development
tooppoo
0
200
コーディングルールの鮮度を保ちたい for SRE NEXT 2026 / keep-fresh-go-internal-conventions-sre-next-2026
handlename
0
150
Terraform標準の組織で AWS CDKをどう使うか
mu7889yoon
1
380
仕様書を書く前にハーネスを作る - Agent Native開発は「探索を速く、判定を固く」
gotalab555
1
330
Featured
See All Featured
A Modern Web Designer's Workflow
chriscoyier
698
190k
エンジニアに許された特別な時間の終わり
watany
108
250k
Building a Scalable Design System with Sketch
lauravandoore
463
34k
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1k
Product Roadmaps are Hard
iamctodd
55
12k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
760
Claude Code のすすめ
schroneko
67
230k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.1k
We Are The Robots
honzajavorek
0
280
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
390
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
340
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]