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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
tsuda.a
December 30, 2022
Programming
1.4k
0
Share
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
85
マジカルインクリメントと指数表記
tsudaahr
0
250
バックアップしていますか?
tsudaahr
0
150
RDB以前のファイル設計の話でもしようか(ぇ
tsudaahr
0
160
NPUわからん
tsudaahr
0
210
計算量オーダーの話
tsudaahr
1
460
クラウド初学者が抱える不安について
tsudaahr
0
330
キューとは何か
tsudaahr
0
280
等幅は死んだ(ぇ
tsudaahr
0
130
Other Decks in Programming
See All in Programming
AIチームを指揮するOSS「TAKT」活用術 / How to Use “TAKT,” an OSS Tool for Orchestrating AI Teams
nrslib
6
750
The Arts and Crafts of Work in the AI Era — Toward Mastery in Software Development
kuranuki
1
670
LLM Plugin for Node-REDの利用方法と開発について
404background
0
140
Oxcを導入して開発体験が向上した話
yug1224
4
250
Composerを使ったサプライチェーン攻撃の様子を眺めてみる #phpstudy
o0h
PRO
2
190
Oxlintはいかにしてtsgolintのlint ruleを呼び出しているのか
syumai
2
1k
サーバーレスで作る、動画データ管理基盤
oyasumipants
0
320
ふつうのFeature Flag実践入門
irof
7
3.3k
色即是空、空即是色、データサイエンス
kamoneggi
1
210
今さら聞けないCancellationToken
htkym
0
200
oxlintはeslint/typescript-eslintを置き換えられるのか
shomafujita
2
290
運用エージェントは "作る" から "育てる" へ - 記憶と自己進化の3層設計パターン / self-evolving-agents-three-layer-agent-design
gawa
12
3.3k
Featured
See All Featured
Building Adaptive Systems
keathley
44
3k
A better future with KSS
kneath
240
18k
WENDY [Excerpt]
tessaabrams
11
38k
The Art of Programming - Codeland 2020
erikaheidi
57
14k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.9k
BBQ
matthewcrist
89
10k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Test your architecture with Archunit
thirion
1
2.3k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
380
Navigating Weather and Climate Data
rabernat
0
200
Building Flexible Design Systems
yeseniaperezcruz
330
40k
Paper Plane (Part 1)
katiecoart
PRO
0
8.1k
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
デメリット? • たぶん激烈に遅い(計測はしていません)
ご清聴ありがとうございました。