internal static void LoadPureUnsafeMethods() { _zero = PureUnsafeMethods.Zero; _copy = PureUnsafeMethods.Copy; _equals = PureUnsafeMethods.Equals; _compare = PureUnsafeMethods.Compare; _and = PureUnsafeMethods.And; _or = PureUnsafeMethods.Or; _xor = PureUnsafeMethods.Xor; }
internal static void LoadNativeMethods() { _nativeLibraryManager?.Dispose(); try { if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { if (RuntimeInformation.ProcessArchitecture == Architecture.X64) { _nativeLibraryManager = new NativeLibraryManager("Assemblies/Omnix.Base.win-x64.dll"); } else { throw new NotSupportedException(); } } else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { if (RuntimeInformation.ProcessArchitecture == Architecture.X64) { _nativeLibraryManager = new NativeLibraryManager("Assemblies/Omnix.Base.linux-x64.so"); } else { throw new NotSupportedException(); } } else { throw new NotSupportedException(); } _zero = _nativeLibraryManager.GetMethod <ZeroDelegate>("zero"); _copy = _nativeLibraryManager.GetMethod <CopyDelegate>("copy"); _equals = _nativeLibraryManager.GetMethod <EqualsDelegate>("equals"); _compare = _nativeLibraryManager.GetMethod <CompareDelegate>("compare"); _and = _nativeLibraryManager.GetMethod <BitwiseOperationDelegate>("math_and"); _or = _nativeLibraryManager.GetMethod <BitwiseOperationDelegate>("math_or"); _xor = _nativeLibraryManager.GetMethod <BitwiseOperationDelegate>("math_xor"); } catch (Exception) { _nativeLibraryManager?.Dispose(); _nativeLibraryManager = null; throw; } }