Skip to content

Commit

Permalink
P/invoke Kernel32.dll only on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
am11 committed Nov 14, 2019
1 parent 1d9f471 commit 57e4e7a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/fsharp/lib.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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.Internal
open FSharp.Compiler.AbstractIL.Internal.Library
Expand Down Expand Up @@ -518,7 +519,7 @@ module UnmanagedProcessExecutionOptions =
// Translation of C# from http://swikb/v1/DisplayOnlineDoc.aspx?entryID=826 and copy in bug://5018
[<System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.Assert, UnmanagedCode = true)>]
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.
Expand Down Expand Up @@ -547,4 +548,4 @@ module StackGuard =

let EnsureSufficientExecutionStack recursionDepth =
if recursionDepth > MaxUncheckedRecursionDepth then
RuntimeHelpers.EnsureSufficientExecutionStack ()
RuntimeHelpers.EnsureSufficientExecutionStack ()

0 comments on commit 57e4e7a

Please sign in to comment.