IT Hit WebDAV IT Hit WebDAV -4 years ago 141
Linux Question

How do I call native Linux and OS X API from .NET Core application?

I need to call file management functions that are not present in .NET Core. How do I call native Linux and Mac OS X API from my C# code?

Edit: The only answer to this question doesn't include any definitive information. Can someone post some code samples or more concrete details about how to invoke Mac OS X APIs from .NET Core?

Answer Source

.NET has a feature called PInvoke (platform invoke) that allows you to call native APIs.

However, getting it to work is not trivial. You need to import the correct platform library. There will also be a performance impact

Check out these links

https://docs.microsoft.com/en-us/dotnet/articles/standard/native-interop https://developers.redhat.com/blog/2016/09/14/pinvoke-in-net-core-rhel/

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download