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
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
100
How to call c# from c++ - meetup app osaka@10
harukasao
0
56
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
改善しないと、タスクが回らない。 “てんこ盛りポジション” を引き継いだ情シスの、入社3ヶ月の業務改善録
krm963
0
270
仕様駆動開発へのトライを機に チームに適合する手法を模索し続けている話
freee
PRO
0
550
琵琶湖の水は止められてもNet--HTTPのリトライは止められない / You might be able to stop the water flow of Lake Biwa but you can't stop Net::HTTP retries
luccafort
PRO
0
740
in-process GraphQL のすすめ #ginzajs
izumin5210
3
1.1k
What's New in Android 2026
veronikapj
0
260
言葉の格闘技のススメ~紙とペンと言葉から始める、キャリアの描き方~
progresscicada
2
150
5分で問診!Composer セキュリティ健康診断
codmoninc
0
1k
php-fpmのプロセスが枯渇した日-調査・対処・そして本当にやるべきだったこと-
shibuchaaaan
0
300
freeeにおけるEvalsの実践例の紹介
freee
PRO
0
120
PHP に部分適用が来るぞ!……ところで何それ?おいしいの? #phpcon / phpcon-2026
shogogg
0
670
komatsuna「分散システムにおけるバグ分析手法」
komatsunaqa
0
260
freee が目指す データ マネジメント戦略 AI-Ready 時代を支える 攻めのガバナンスとは
freee
PRO
0
390
Featured
See All Featured
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
650
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.8k
30 Presentation Tips
portentint
PRO
1
370
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.8k
The Limits of Empathy - UXLibs8
cassininazir
1
610
Measuring & Analyzing Core Web Vitals
bluesmoon
9
960
How to Talk to Developers About Accessibility
jct
2
520
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
250
Darren the Foodie - Storyboard
khoart
PRO
3
3.6k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
66
57k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
123
22k
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]