Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using .PYD file in C#?

Tags:

python

c#

pyd

I am developing a program using C#, but I just figured out that what I am going to program is very very difficult in C# yet easy in Python. So what I want to do is make a .PYD file and use it in C# program, but I don't know how. I've been searching about it but I couldn't find anything.

So these are my questions: How do I use .PYD file in C#? I know that .PYD files are similar to .DLL files, so are .PYD files still usable in computers that have no Python installed?

like image 742
cylee Avatar asked Oct 20 '25 15:10

cylee


1 Answers

A .pyd file IS a DLL but with function init*() where * is the name of your .pyd file. For example, spam.pyd has a function named initspam(). They are not just similar, but the same! They are usable on PCs without Python.


Do not forget: builtins will NOT be available. Search for them in C, add them as an extern in your Cython code and compile!

like image 70
Kotauskas Avatar answered Oct 23 '25 11:10

Kotauskas



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!