From 1e30a5ac24a020a16848d535a5905b192371203b Mon Sep 17 00:00:00 2001 From: Adeel Mujahid Date: Fri, 15 Nov 2019 02:33:07 +0200 Subject: [PATCH] P/invoke Kernel32.dll only on Windows (#7858) --- src/fsharp/lib.fs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/fsharp/lib.fs b/src/fsharp/lib.fs index 6c4599f8a..2cec1e666 100755 --- a/src/fsharp/lib.fs +++ b/src/fsharp/lib.fs @@ -4,6 +4,7 @@ module internal FSharp.Compiler.Lib open System.IO open System.Collections.Generic +open System.Runtime.InteropServices open Internal.Utilities open FSharp.Compiler.AbstractIL open FSharp.Compiler.AbstractIL.Internal @@ -515,7 +516,7 @@ module UnmanagedProcessExecutionOptions = // Translation of C# from http://swikb/v1/DisplayOnlineDoc.aspx?entryID=826 and copy in bug://5018 [] let EnableHeapTerminationOnCorruption() = - if (System.Environment.OSVersion.Version.Major >= 6 && // If OS is Vista or higher + if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && System.Environment.OSVersion.Version.Major >= 6 && // If OS is Vista or higher System.Environment.Version.Major < 3) then // and CLR not 3.0 or higher // "The flag HeapSetInformation sets is available in Windows XP SP3 and later. // The data structure used for heap information is available on earlier versions of Windows. @@ -544,4 +545,4 @@ module StackGuard = let EnsureSufficientExecutionStack recursionDepth = if recursionDepth > MaxUncheckedRecursionDepth then - RuntimeHelpers.EnsureSufficientExecutionStack () \ No newline at end of file + RuntimeHelpers.EnsureSufficientExecutionStack () -- 2.23.0