Reputation: 11
i have written python function that imports several packages to detect and interps barcode in a pic. and know i want to use this function in C#. and my question is how can i compile .py to .dll
Upvotes: 0
Views: 3962
Reputation: 1289
You can not, at least with CPython (the reference implementation of Python).
However, you may try using IronPython — a .NET implementation of Python. It allows your python code to use .NET libraries and vice versa. Note that it only supports Python 2.7.
For more info about different python implementations see https://wiki.python.org/moin/PythonImplementations and https://www.python.org/download/alternatives/
Upvotes: 1
Reputation: 1196
This is never a good idea to make your code import another code from another coding language. The best would be to find a C# library that suits your needs.
Though, I encourage you to look over IronPython, which is helping inter-languages purposes.
Upvotes: 0