NativeLibrary is a new class in .NET Core 3.0 for interacting with native libraries. In this article, we’ll take a closer look.
.NET makes it simple to call functions from a native library using
[DllImport("mylibrary")] public static extern int foo();
This code makes available the function
foo from the native library
mylibrary. This function accepts no arguments and returns an
int. .NET takes care of marshaling the argument types. It is possible to use managed types (like strings), which will be automagically marshaled.
Continue reading “Interacting with native libraries in .NET Core 3.0”