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
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
220
バックアップしていますか?
tsudaahr
0
130
RDB以前のファイル設計の話でもしようか(ぇ
tsudaahr
0
130
NPUわからん
tsudaahr
0
190
計算量オーダーの話
tsudaahr
1
400
クラウド初学者が抱える不安について
tsudaahr
0
290
キューとは何か
tsudaahr
0
240
等幅は死んだ(ぇ
tsudaahr
0
110
いくら眺めてもエラーの理由がわからないコードについて
tsudaahr
0
190
Other Decks in Programming
See All in Programming
Developing static sites with Ruby
okuramasafumi
0
330
Kotlin Multiplatform Meetup - Compose Multiplatform 외부 의존성 아키텍처 설계부터 운영까지
wisemuji
0
140
AI時代を生き抜く 新卒エンジニアの生きる道
coconala_engineer
1
470
組み合わせ爆発にのまれない - 責務分割 x テスト
halhorn
1
170
マスタデータ問題、マイクロサービスでどう解くか
kts
0
150
実はマルチモーダルだった。ブラウザの組み込みAI🧠でWebの未来を感じてみよう #jsfes #gemini
n0bisuke2
3
1.3k
GoLab2025 Recap
kuro_kurorrr
0
780
リリース時」テストから「デイリー実行」へ!開発マネージャが取り組んだ、レガシー自動テストのモダン化戦略
goataka
0
150
令和最新版Android Studioで化石デバイス向けアプリを作る
arkw
0
460
AtCoder Conference 2025
shindannin
0
790
안드로이드 9년차 개발자, 프론트엔드 주니어로 커리어 리셋하기
maryang
1
140
Findy AI+の開発、運用におけるMCP活用事例
starfish719
0
1.8k
Featured
See All Featured
Designing for Timeless Needs
cassininazir
0
100
Unsuck your backbone
ammeep
671
58k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
140
The Hidden Cost of Media on the Web [PixelPalooza 2025]
tammyeverts
2
130
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
196
70k
Learning to Love Humans: Emotional Interface Design
aarron
274
41k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
34
2.6k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Are puppies a ranking factor?
jonoalderson
0
2.5k
How to Think Like a Performance Engineer
csswizardry
28
2.4k
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
VelocityConf: Rendering Performance Case Studies
addyosmani
333
24k
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
デメリット? • たぶん激烈に遅い(計測はしていません)
ご清聴ありがとうございました。