Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Python から.net DLL を呼び出す
Search
tsuda.a
December 30, 2022
Programming
0
1.3k
Python から.net DLL を呼び出す
Python (Iron Python ではなく、普通のいわゆる cPython (ver3系)) で .net core の DLL を呼び出してみた例です。
tsuda.a
December 30, 2022
Tweet
Share
More Decks by tsuda.a
See All by tsuda.a
マジカルインクリメントと指数表記
tsudaahr
0
210
バックアップしていますか?
tsudaahr
0
120
RDB以前のファイル設計の話でもしようか(ぇ
tsudaahr
0
130
NPUわからん
tsudaahr
0
180
計算量オーダーの話
tsudaahr
1
400
クラウド初学者が抱える不安について
tsudaahr
0
280
キューとは何か
tsudaahr
0
240
等幅は死んだ(ぇ
tsudaahr
0
110
いくら眺めてもエラーの理由がわからないコードについて
tsudaahr
0
190
Other Decks in Programming
See All in Programming
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
270
モデル駆動設計をやってみようワークショップ開催報告(Modeling Forum2025) / model driven design workshop report
haru860
0
280
TestingOsaka6_Ozono
o3
0
170
エディターってAIで操作できるんだぜ
kis9a
0
750
生成AI時代を勝ち抜くエンジニア組織マネジメント
coconala_engineer
0
370
Canon EOS R50 V と R5 Mark II 購入でみえてきた最近のデジイチ VR180 事情、そして VR180 静止画に活路を見出すまで
karad
0
130
AIコーディングエージェント(skywork)
kondai24
0
200
Full-Cycle Reactivity in Angular: SignalStore mit Signal Forms und Resources
manfredsteyer
PRO
0
170
脳の「省エネモード」をデバッグする ~System 1(直感)と System 2(論理)の切り替え~
panda728
PRO
0
120
AtCoder Conference 2025「LLM時代のAHC」
imjk
2
560
Go コードベースの構成と AI コンテキスト定義
andpad
0
130
AI時代を生き抜く 新卒エンジニアの生きる道
coconala_engineer
1
400
Featured
See All Featured
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.1k
Rails Girls Zürich Keynote
gr2m
95
14k
A designer walks into a library…
pauljervisheath
210
24k
Principles of Awesome APIs and How to Build Them.
keavy
127
17k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
260
Ruling the World: When Life Gets Gamed
codingconduct
0
94
Skip the Path - Find Your Career Trail
mkilby
0
25
Building a Modern Day E-commerce SEO Strategy
aleyda
45
8.4k
sira's awesome portfolio website redesign presentation
elsirapls
0
89
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
61
47k
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
29
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
10
750
Transcript
Python から .net DLL を 呼び出す すごい広島 .rb with Python[69]
オンライン LTDD 2022-12 #1 @tsuda_ahr
準備 pip install pythonnet ※ .net core のインストールは済んでいるものとします
Visual Studio で dll を作成 (.net core で作ります) namespace PythonTestNamespace
{ public class PythonTestClass { public int Add(int value1, int value2) { return value1 + value2; } } }
Python のコードを書く from pythonnet import load Load(“coreclr”) import clr clr.AddReference('PythonTest')
from PythonTestNamespace import PythonTestClass test = PythonTestClass() ver = test.Add(1, 2) print(ver) .net core の CLR を使用 (これを書かないと .net framework になる) DLL を Load Class を Import
同じフォルダに配置
実行
よって ライブラリロジックは C# で書いて、それを Python で操ることが可能!
そんなことをして何が楽しいのか?
Powershell (pwsh) からでも使えるよ!
C# DLL WindowsApp Python Powershell Excel VBA つまりいろんな環境から呼び出せる。 Winows Only
Winows or Linux or Mac
デメリット? • たぶん激烈に遅い(計測はしていません)
ご清聴ありがとうございました。