forked from dotnet/source-build
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path0004-P-invoke-Kernel32.dll-only-on-Windows-7858.patch
More file actions
40 lines (35 loc) · 1.82 KB
/
0004-P-invoke-Kernel32.dll-only-on-Windows-7858.patch
File metadata and controls
40 lines (35 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
From 1e30a5ac24a020a16848d535a5905b192371203b Mon Sep 17 00:00:00 2001
From: Adeel Mujahid <adeelbm@outlook.com>
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
[<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.
@@ -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