Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Python から.net DLL を呼び出す
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
140
マジカルインクリメントと指数表記
tsudaahr
0
290
バックアップしていますか?
tsudaahr
0
170
RDB以前のファイル設計の話でもしようか(ぇ
tsudaahr
0
180
NPUわからん
tsudaahr
0
230
計算量オーダーの話
tsudaahr
1
490
クラウド初学者が抱える不安について
tsudaahr
0
470
キューとは何か
tsudaahr
0
310
等幅は死んだ(ぇ
tsudaahr
0
150
Other Decks in Programming
See All in Programming
マイコン向けの軽量Ruby「PicoRuby」で各種デバイスを制御するネイティブアプリの実現手法
bash0c7
0
460
Intent as Code
shoppingjaws
6
1.1k
App Storeの外へ──日本のiOSサイドローディング入門 for iOSDC Japan 2026
yuukiw00w
0
280
SREの越境 / SRE Collaboration
y0hgi
2
290
IBM Bob Dojo #1 仕様駆動開発入門
oniak3ibm
PRO
0
320
Findy - エンジニア向け会社紹介/Findy Company Deck
findyinc
6
400k
モジュールの視点からSwiftを読み解く #iosdc
s_shimotori
0
270
技術的負債を組織課題として解く-増えすぎたマイクロサービスとの戦い-
reimaru
1
2.5k
Turning Architecture into Unit Tests in the AI Era (NSSpain XIV)
steliosf
PRO
1
120
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
360
Omarchy Tokyo やると聞いて UMPC 買ってセットアップしてきた
mtsmfm
0
190
ソニーのクラウド共通基盤の変遷とAI時代の開発スタイルに合わせた進化 / The Journey of Sony’s Common Cloud Platform and Its Evolution for AI-Native Development
kenjiyoneyama
0
200
Featured
See All Featured
Music & Morning Musume
bryan
48
7.4k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
2.1k
Raft: Consensus for Rubyists
vanstee
142
7.7k
Testing 201, or: Great Expectations
jmmastey
46
8.3k
Mobile First: as difficult as doing things right
swwweet
225
10k
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
320
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
Building Adaptive Systems
keathley
44
3.2k
職位にかかわらず全員がリーダーシップを発揮するチーム作り / Building a team where everyone can demonstrate leadership regardless of position
madoxten
69
66k
Making the Leap to Tech Lead
cromwellryan
135
10k
4 Signs Your Business is Dying
shpigford
187
23k
Tips & Tricks on How to Get Your First Job In Tech
honzajavorek
1
780
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
デメリット? • たぶん激烈に遅い(計測はしていません)
ご清聴ありがとうございました。