public static void PreloadDll(string dllName) { var dllDir = GetDirectedDllDirectory(); // Not using OperatingSystem.Platform. // See: https://www.mono-project.com/docs/faq/technical/#how-to-detect-the-execution-platform if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { Win32.LoadDll(dllDir, dllName); } else { Posix.LoadDll(dllDir, dllName); } }