static Proxy() { IsWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows); // TODO: test with MACs Context = IsWindows ? Win64Lib.secp256k1_context_create(Secp256K1ContextSign | Secp256K1ContextVerify) : PosixLib.secp256k1_context_create(Secp256K1ContextSign | Secp256K1ContextVerify); }
private static IntPtr CreateContext() { return(Platform switch { OsPlatform.Windows => Win64Lib.secp256k1_context_create(Secp256K1ContextSign | Secp256K1ContextVerify), OsPlatform.Linux => PosixLib.secp256k1_context_create(Secp256K1ContextSign | Secp256K1ContextVerify), OsPlatform.Mac => MacLib.secp256k1_context_create(Secp256K1ContextSign | Secp256K1ContextVerify), _ => throw new InvalidOperationException("Unsupported platform.") });
private static IntPtr CreateContext() { switch (Platform) { case OsPlatform.Windows: return(Win64Lib.secp256k1_context_create(Secp256K1ContextSign | Secp256K1ContextVerify)); case OsPlatform.Linux: return(PosixLib.secp256k1_context_create(Secp256K1ContextSign | Secp256K1ContextVerify)); case OsPlatform.Mac: return(MacLib.secp256k1_context_create(Secp256K1ContextSign | Secp256K1ContextVerify)); } throw new InvalidOperationException("Unsupported platform."); }