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.2k
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
180
バックアップしていますか?
tsudaahr
0
110
RDB以前のファイル設計の話でもしようか(ぇ
tsudaahr
0
120
NPUわからん
tsudaahr
0
170
計算量オーダーの話
tsudaahr
1
390
クラウド初学者が抱える不安について
tsudaahr
0
260
キューとは何か
tsudaahr
0
220
等幅は死んだ(ぇ
tsudaahr
0
94
いくら眺めてもエラーの理由がわからないコードについて
tsudaahr
0
180
Other Decks in Programming
See All in Programming
ぬるぬる動かせ! Riveでアニメーション実装🐾
kno3a87
1
110
react-callを使ってダイヤログをいろんなとこで再利用しよう!
shinaps
1
120
Flutter with Dart MCP: All You Need - 박제창 2025 I/O Extended Busan
itsmedreamwalker
0
130
意外と簡単!?フロントエンドでパスキー認証を実現する WebAuthn
teamlab
PRO
0
140
オープンセミナー2025@広島「君はどこで動かすか?」アンケート結果
satoshi256kbyte
0
240
レガシープロジェクトで最大限AIの恩恵を受けられるようClaude Codeを利用する
tk1351
4
1.6k
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
200
フロントエンドのmonorepo化と責務分離のリアーキテクト
kajitack
2
160
MCPで実現するAIエージェント駆動のNext.jsアプリデバッグ手法
nyatinte
7
1k
AI時代のUIはどこへ行く?
yusukebe
13
7.8k
為你自己學 Python - 冷知識篇
eddie
1
340
Swift Updates - Learn Languages 2025
koher
2
430
Featured
See All Featured
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
18
1.1k
Visualization
eitanlees
148
16k
What's in a price? How to price your products and services
michaelherold
246
12k
The Power of CSS Pseudo Elements
geoffreycrofte
77
5.9k
Six Lessons from altMBA
skipperchong
28
4k
How GitHub (no longer) Works
holman
315
140k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
The Language of Interfaces
destraynor
161
25k
Music & Morning Musume
bryan
46
6.8k
The Pragmatic Product Professional
lauravandoore
36
6.8k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.1k
Agile that works and the tools we love
rasmusluckow
330
21k
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
デメリット? • たぶん激烈に遅い(計測はしていません)
ご清聴ありがとうございました。