I have developed an app in Python under Raspbian (on a Raspberry Pi) and I need to call some methods from a C# dll that was not developed by me.

I have previously called methods from a C# dll in Windows, using Pythonnet.

But in this case the app is running under Linux and I do not know if I can call the methods. So is it possible to call a C# dll in Python under Linux? If so, how?

1 Answers

2
user2969477 On Best Solutions

To call any kind of .NET code, you'll need a runtime for it.

For Mono, you'll want to look at this: https://www.mono-project.com/docs/advanced/embedding/.

If you find the embedding procedure too complex, you might want to write a wrapper for the library that can communicate over some message passing protocol (TCP/IP, shared memory, etc.), for which you can easily serialize/deserialize in both .NET and Python, and run it in its own process.