From: Jan Kotas Date: Thu, 28 Mar 2019 05:37:22 +0000 (-0700) Subject: Move QueryPerformanceCounter PInvokes to shared (dotnet/corefx#36409) X-Git-Tag: accepted/tizen/unified/20190813.215958~54^2~64 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=378a0424d350911b569ff3ab0263bb1c1e5fa5ba;p=platform%2Fupstream%2Fcoreclr.git Move QueryPerformanceCounter PInvokes to shared (dotnet/corefx#36409) Signed-off-by: dotnet-bot --- diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.QueryPerformanceCounter.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.QueryPerformanceCounter.cs new file mode 100644 index 0000000..ddc9797 --- /dev/null +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.QueryPerformanceCounter.cs @@ -0,0 +1,22 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +internal partial class Interop +{ + internal partial class Kernel32 + { + // The actual native signature is: + // BOOL WINAPI QueryPerformanceCounter( + // _Out_ LARGE_INTEGER* lpPerformanceCount + // ); + // + // We take a long* (rather than a out long) to avoid the pinning overhead. + // We don't set last error since we don't need the extended error info. + + [DllImport(Libraries.Kernel32, ExactSpelling = true)] + internal static extern unsafe BOOL QueryPerformanceCounter(long* lpPerformanceCount); + } +} diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.QueryPerformanceFrequency.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.QueryPerformanceFrequency.cs new file mode 100644 index 0000000..72a48ba --- /dev/null +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.QueryPerformanceFrequency.cs @@ -0,0 +1,22 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.InteropServices; + +internal partial class Interop +{ + internal partial class Kernel32 + { + // The actual native signature is: + // BOOL WINAPI QueryPerformanceFrequency( + // _Out_ LARGE_INTEGER* lpFrequency + // ); + // + // We take a long* (rather than a out long) to avoid the pinning overhead. + // We don't set last error since we don't need the extended error info. + + [DllImport(Libraries.Kernel32, ExactSpelling = true)] + internal static extern unsafe BOOL QueryPerformanceFrequency(long* lpFrequency); + } +} diff --git a/src/System.Private.CoreLib/shared/System.Private.CoreLib.Shared.projitems b/src/System.Private.CoreLib/shared/System.Private.CoreLib.Shared.projitems index 3cd36e0..3b56c77 100644 --- a/src/System.Private.CoreLib/shared/System.Private.CoreLib.Shared.projitems +++ b/src/System.Private.CoreLib/shared/System.Private.CoreLib.Shared.projitems @@ -1027,6 +1027,8 @@ + +