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
Python から.net DLL を呼び出す
Search
tsuda.a
December 30, 2022
Programming
1.4k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Python から.net DLL を呼び出す
Python (Iron Python ではなく、普通のいわゆる cPython (ver3系)) で .net core の DLL を呼び出してみた例です。
tsuda.a
December 30, 2022
More Decks by tsuda.a
See All by tsuda.a
Git を GUI で使う話
tsudaahr
0
120
マジカルインクリメントと指数表記
tsudaahr
0
280
バックアップしていますか?
tsudaahr
0
160
RDB以前のファイル設計の話でもしようか(ぇ
tsudaahr
0
170
NPUわからん
tsudaahr
0
230
計算量オーダーの話
tsudaahr
1
480
クラウド初学者が抱える不安について
tsudaahr
0
470
キューとは何か
tsudaahr
0
300
等幅は死んだ(ぇ
tsudaahr
0
140
Other Decks in Programming
See All in Programming
[PyCon KR 2026] More Variants, More Diversity for AI Accelerators
achimnol
0
100
Hono + Inertia + React で LP を構築した話
oukayuka
2
150
Discordを用いたラボオートメーション関連情報収集の自動化
noguhiro2002
0
380
まだ間に合う!今年の夏こそSchemeのマクロ展開器を完全理解!
omasanori
0
390
AI Engineeringは、AIプロダクトだけのものか? 〜AIがソフトウェアを作る時代の新しい当たり前〜 / No AI in your product. AI Engineering in your development.
rkaga
5
510
TSX の <Hoge<Fuga>> という構文に驚いた話 / tsx-type-argument-syntax
kanaru0928
0
240
仕様駆動開発へのトライを機に チームに適合する手法を模索し続けている話
freee
PRO
0
590
typoなんかねぇよ
raspython3
0
430
メールのエイリアス機能を履き違えない
isshinfunada
0
250
What's New in Android 2026
veronikapj
0
270
属人化した知識を、 AIが辿れる地図にする
pkshadeck
PRO
1
200
VibeCodingからAgenticWorkflowへ
starfish719
0
770
Featured
See All Featured
Git: the NoSQL Database
bkeepers
PRO
432
67k
Designing Powerful Visuals for Engaging Learning
tmiket
1
500
Utilizing Notion as your number one productivity tool
mfonobong
4
550
Raft: Consensus for Rubyists
vanstee
141
7.6k
Getting science done with accelerated Python computing platforms
jacobtomlinson
2
450
YesSQL, Process and Tooling at Scale
rocio
174
15k
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
900
Into the Great Unknown - MozCon
thekraken
41
2.7k
Navigating Weather and Climate Data
rabernat
0
490
ピンチをチャンスに:未来をつくるプロダクトロードマップ #pmconf2020
aki_iinuma
128
56k
Reality Check: Gamification 10 Years Later
codingconduct
0
2.3k
Making the Leap to Tech Lead
cromwellryan
135
10k
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
デメリット? • たぶん激烈に遅い(計測はしていません)
ご清聴ありがとうございました。