Use C# DLL in Python


I have a driver which is written in C#, .NET 4.7.0 and build as DLL. I don't have sources from this driver. I want to use this driver in python application.

I wrapped some functionality from driver into method of another C# project. Then I built it into DLL. I used RGiesecke.DllExport to make one method available in python. When i call this method from python using ctypes, I get WinError -532462766 Windows Error 0xe0434352.

If I exclude driver code and keep only wrapper code in exported method everything runs fine.

Could you please give me some advice how to make this working or help me find better sollution? Moving from python to IronPython is no option here.

Thank you.


1 Answer


PROBLEM CAUSE: Python didn't run wrapper from directory where it was stored together with driver. That caused problem with loading driver.

User contributions licensed under CC BY-SA 3.0