Skip to content

Commit 3dcd422

Browse files
authored
Exclude code that will never run on Apple (#3187)
1 parent b06ee8d commit 3dcd422

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

binding/Binding.Shared/PlatformConfiguration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public static string LinuxFlavor
8585
set => linuxFlavor = value;
8686
}
8787

88-
#if WINDOWS_UWP
88+
#if WINDOWS_UWP || __IOS__ || __TVOS__ || __MACOS__ || __MACCATALYST__ || __ANDROID__
8989
public static bool IsGlibc { get; }
9090
#else
9191
private static readonly Lazy<bool> isGlibcLazy = new Lazy<bool> (IsGlibcImplementation);

binding/SkiaSharp/PlatformLock.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,11 @@ public static IPlatformLock Create ()
6868
/// <returns>A reference to a new platform lock implementation</returns>
6969
public static IPlatformLock DefaultFactory ()
7070
{
71+
#if !(__IOS__ || __TVOS__ || __MACOS__ || __MACCATALYST__ || __ANDROID__)
7172
if (PlatformConfiguration.IsWindows)
7273
return new NonAlertableWin32Lock ();
7374
else
75+
#endif
7476
return new ReadWriteLock ();
7577
}
7678

@@ -90,6 +92,7 @@ class ReadWriteLock : IPlatformLock
9092
ReaderWriterLockSlim _lock = new ReaderWriterLockSlim ();
9193
}
9294

95+
#if !(__IOS__ || __TVOS__ || __MACOS__ || __MACCATALYST__ || __ANDROID__)
9396
/// <summary>
9497
/// Windows platform lock uses Win32 CRITICAL_SECTION
9598
/// </summary>
@@ -169,6 +172,6 @@ public struct CRITICAL_SECTION
169172
static extern void LeaveCriticalSection (IntPtr lpCriticalSection);
170173
#endif
171174
}
175+
#endif
172176
}
173-
174177
}

binding/SkiaSharp/SKAutoCoInitialize.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ public partial class SKAutoCoInitialize : IDisposable
1212

1313
public SKAutoCoInitialize()
1414
{
15+
#if !(__IOS__ || __TVOS__ || __MACOS__ || __MACCATALYST__ || __ANDROID__)
1516
if (PlatformConfiguration.IsWindows)
1617
hResult = CoInitializeEx(IntPtr.Zero, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
1718
else
19+
#endif
1820
hResult = S_OK;
1921
}
2022

@@ -24,8 +26,10 @@ public void Uninitialize()
2426
{
2527
if (hResult >= 0)
2628
{
29+
#if !(__IOS__ || __TVOS__ || __MACOS__ || __MACCATALYST__ || __ANDROID__)
2730
if (PlatformConfiguration.IsWindows)
2831
CoUninitialize();
32+
#endif
2933

3034
hResult = -1;
3135
}
@@ -41,6 +45,7 @@ public void Uninitialize()
4145
private const uint COINIT_DISABLE_OLE1DDE = 0x4;
4246
private const uint COINIT_SPEED_OVER_MEMORY = 0x8;
4347

48+
#if !(__IOS__ || __TVOS__ || __MACOS__ || __MACCATALYST__ || __ANDROID__)
4449
#if USE_LIBRARY_IMPORT
4550
[LibraryImport("ole32.dll", SetLastError = true)]
4651
private static partial long CoInitializeEx(IntPtr pvReserved, uint dwCoInit);
@@ -51,6 +56,7 @@ public void Uninitialize()
5156
private static extern long CoInitializeEx([In, Optional] IntPtr pvReserved, [In] uint dwCoInit);
5257
[DllImport("ole32.dll", CharSet = CharSet.Ansi, SetLastError = true, CallingConvention = CallingConvention.StdCall)]
5358
private static extern void CoUninitialize();
59+
#endif
5460
#endif
5561
}
5662
}

0 commit comments

Comments
 (0)