Search code examples
c#linuxdrivers

Using custom linux drivers in c#


Is it possible to use Linux drivers in C#? If so, how?

I'm starting a project that will use some custom drivers to talk to some hardware and while I know how to do it in C/C++, the UI side of the project will be an ASP.NET webserver, and it'd be nice to have both sides in one language.


Solution

  • If your drivers are accessible as shared libraries, you can p/invoke into them. If the shared libraries have unusual arguments types, you might have to get creative in how you define matching data structures for marshalling, but this is probably the easiest way.

    If your drivers are accessible through the traditional open/close/read/write/ioctl, then this question should get you on your way.