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
100
マジカルインクリメントと指数表記
tsudaahr
0
250
バックアップしていますか?
tsudaahr
0
150
RDB以前のファイル設計の話でもしようか(ぇ
tsudaahr
0
160
NPUわからん
tsudaahr
0
220
計算量オーダーの話
tsudaahr
1
460
クラウド初学者が抱える不安について
tsudaahr
0
340
キューとは何か
tsudaahr
0
280
等幅は死んだ(ぇ
tsudaahr
0
130
Other Decks in Programming
See All in Programming
才能?センス?知らん、 続けたもん勝ちだ。-- 結婚・出産・癌を越えてなお、私がプロダクトを創り続ける理由
16bitidol
1
330
LLMによるContent Moderationの本番運用の裏側と品質担保への挑戦
suikabar
3
770
鹿野さんに聞く!『TypeScriptコードレシピ集』で磨く実践力
tonkotsuboy_com
3
780
コンテキストの使い捨てをやめる — ビジネスルール駆動開発と miko —
ioki
0
230
「なぜそう決めたのか」を残し続ける仕組み ― Notion AI カスタムエージェント × Slack連携による設計判断の自動記録 - NIKKEI Tech Talk #47
niftycorp
PRO
0
230
Spec Driven Development | AI Summit Lisbon
danielsogl
PRO
0
210
はてなアカウント基盤 State of the Union
cockscomb
0
710
Skillsは効率化、Agentsは"自分の拡張"——Builder時代のエージェント編成(CC Night 2026)
wemra
1
160
例外の正しい扱い方 そのエラー try-catchして大丈夫?
jinwatanabe
0
280
スマートグラスで並列バイブコーディング
hyshu
0
260
Performance Engineering for Everyone
elenatanasoiu
0
220
Snowflake Summitでの新機能 CoCo / CoWork / snowflake-summit-2026-overall-what-new-coco
tatsuhiro
1
180
Featured
See All Featured
Sam Torres - BigQuery for SEOs
techseoconnect
PRO
0
290
YesSQL, Process and Tooling at Scale
rocio
174
15k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.9k
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
2
1.6k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
72
40k
sira's awesome portfolio website redesign presentation
elsirapls
0
280
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
190
Typedesign – Prime Four
hannesfritz
42
3.1k
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
210
The Cult of Friendly URLs
andyhume
79
6.9k
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
デメリット? • たぶん激烈に遅い(計測はしていません)
ご清聴ありがとうございました。