summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/System.Private.CoreLib/src/Interop/Unix/Interop.Libraries.cs12
-rw-r--r--src/dlls/mscoree/mscorwks_unixexports.src39
-rw-r--r--src/vm/ecalllist.h55
-rw-r--r--tests/src/readytorun/CMakeLists.txt1
-rw-r--r--tests/src/readytorun/tests/CMakeLists.txt6
-rw-r--r--tests/src/readytorun/tests/main.cs10
-rw-r--r--tests/src/readytorun/tests/mainv1.csproj1
-rw-r--r--tests/src/readytorun/tests/mainv2.csproj1
-rw-r--r--tests/src/readytorun/tests/native.cpp6
-rw-r--r--tests/src/readytorun/tests/test.cs16
10 files changed, 81 insertions, 66 deletions
diff --git a/src/System.Private.CoreLib/src/Interop/Unix/Interop.Libraries.cs b/src/System.Private.CoreLib/src/Interop/Unix/Interop.Libraries.cs
index da7cbf29d2..2e54ff8c06 100644
--- a/src/System.Private.CoreLib/src/Interop/Unix/Interop.Libraries.cs
+++ b/src/System.Private.CoreLib/src/Interop/Unix/Interop.Libraries.cs
@@ -2,14 +2,16 @@
// 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.CompilerServices;
+
internal static partial class Interop
{
internal static partial class Libraries
{
- internal const string Kernel32 = "libcoreclr";
- internal const string User32 = "libcoreclr";
- internal const string Ole32 = "libcoreclr";
- internal const string OleAut32 = "libcoreclr";
- internal const string Advapi32 = "libcoreclr";
+ internal const string Kernel32 = JitHelpers.QCall;
+ internal const string User32 = JitHelpers.QCall;
+ internal const string Ole32 = JitHelpers.QCall;
+ internal const string OleAut32 = JitHelpers.QCall;
+ internal const string Advapi32 = JitHelpers.QCall;
}
}
diff --git a/src/dlls/mscoree/mscorwks_unixexports.src b/src/dlls/mscoree/mscorwks_unixexports.src
index 6ba08c9af8..98db67bd1a 100644
--- a/src/dlls/mscoree/mscorwks_unixexports.src
+++ b/src/dlls/mscoree/mscorwks_unixexports.src
@@ -19,42 +19,3 @@ PAL_UnregisterModule
CoreDllMain
DllMain
GetCLRRuntimeHost
-
-; Win32 API and other PAL functions used by the System.Private.CoreLib
-CloseHandle
-CoTaskMemAlloc
-CoTaskMemRealloc
-CoTaskMemFree
-CreateEventW
-CreateEventExW
-CreateMutexW
-CreateMutexExW
-CreateSemaphoreW
-CreateSemaphoreExW
-FormatMessageW
-FreeEnvironmentStringsW
-GetCurrentProcessId
-GetCurrentThreadId
-GetEnvironmentStringsW
-GetEnvironmentVariableW
-GetStdHandle
-GetSystemInfo
-LocalAlloc
-LocalReAlloc
-LocalFree
-OpenEventW
-OpenMutexW
-OpenSemaphoreW
-OutputDebugStringW
-QueryPerformanceCounter
-QueryPerformanceFrequency
-ReleaseMutex
-ReleaseSemaphore
-ResetEvent
-SetEnvironmentVariableW
-SetEvent
-SysAllocStringByteLen
-SysAllocStringLen
-SysFreeString
-SysStringLen
-WriteFile
diff --git a/src/vm/ecalllist.h b/src/vm/ecalllist.h
index b63d216050..3b9d6b1515 100644
--- a/src/vm/ecalllist.h
+++ b/src/vm/ecalllist.h
@@ -1140,6 +1140,54 @@ FCFuncStart(gWeakReferenceOfTFuncs)
FCFuncElement("IsTrackResurrection", WeakReferenceOfTNative::IsTrackResurrection)
FCFuncEnd()
+#ifdef FEATURE_PAL
+FCFuncStart(gPalKernel32Funcs)
+ QCFuncElement("CloseHandle", CloseHandle)
+ QCFuncElement("CreateEvent", CreateEventW)
+ QCFuncElement("CreateEventEx", CreateEventExW)
+ QCFuncElement("CreateMutex", CreateMutexW)
+ QCFuncElement("CreateMutexEx", CreateMutexExW)
+ QCFuncElement("CreateSemaphore", CreateSemaphoreW)
+ QCFuncElement("CreateSemaphoreEx", CreateSemaphoreExW)
+ QCFuncElement("FormatMessage", FormatMessageW)
+ QCFuncElement("FreeEnvironmentStrings", FreeEnvironmentStringsW)
+ QCFuncElement("GetCurrentProcessId", GetCurrentProcessId)
+ QCFuncElement("GetCurrentThreadId", GetCurrentThreadId)
+ QCFuncElement("GetEnvironmentStrings", GetEnvironmentStringsW)
+ QCFuncElement("GetEnvironmentVariable", GetEnvironmentVariableW)
+ QCFuncElement("GetStdHandle", GetStdHandle)
+ QCFuncElement("GetSystemInfo", GetSystemInfo)
+ QCFuncElement("LocalAlloc", LocalAlloc)
+ QCFuncElement("LocalReAlloc", LocalReAlloc)
+ QCFuncElement("LocalFree", LocalFree)
+ QCFuncElement("OpenEvent", OpenEventW)
+ QCFuncElement("OpenMutex", OpenMutexW)
+ QCFuncElement("OpenSemaphore", OpenSemaphoreW)
+ QCFuncElement("OutputDebugString", OutputDebugStringW)
+ QCFuncElement("QueryPerformanceCounter", QueryPerformanceCounter)
+ QCFuncElement("QueryPerformanceFrequency", QueryPerformanceFrequency)
+ QCFuncElement("ReleaseMutex", ReleaseMutex)
+ QCFuncElement("ReleaseSemaphore", ReleaseSemaphore)
+ QCFuncElement("ResetEvent", ResetEvent)
+ QCFuncElement("SetEnvironmentVariable", SetEnvironmentVariableW)
+ QCFuncElement("SetEvent", SetEvent)
+ QCFuncElement("WriteFile", WriteFile)
+FCFuncEnd()
+
+FCFuncStart(gPalOle32Funcs)
+ QCFuncElement("CoTaskMemAlloc", CoTaskMemAlloc)
+ QCFuncElement("CoTaskMemRealloc", CoTaskMemRealloc)
+ QCFuncElement("CoTaskMemFree", CoTaskMemFree)
+FCFuncEnd()
+
+FCFuncStart(gPalOleAut32Funcs)
+ QCFuncElement("SysAllocStringByteLen", SysAllocStringByteLen)
+ QCFuncElement("SysAllocStringLen", SysAllocStringLen)
+ QCFuncElement("SysFreeString", SysFreeString)
+ QCFuncElement("SysStringLen", SysStringLen)
+FCFuncEnd()
+#endif
+
#ifdef FEATURE_COMINTEROP
//
@@ -1215,6 +1263,9 @@ FCClassElement("IReflect", "System.Reflection", gStdMngIReflectFuncs)
FCClassElement("InterfaceMarshaler", "System.StubHelpers", gInterfaceMarshalerFuncs)
#endif
FCClassElement("Interlocked", "System.Threading", gInterlockedFuncs)
+#if FEATURE_PAL
+FCClassElement("Kernel32", "", gPalKernel32Funcs)
+#endif
FCClassElement("LoaderAllocatorScout", "System.Reflection", gLoaderAllocatorFuncs)
FCClassElement("Marshal", "System.Runtime.InteropServices", gInteropMarshalFuncs)
FCClassElement("Math", "System", gMathFuncs)
@@ -1241,6 +1292,10 @@ FCClassElement("Object", "System", gObjectFuncs)
#ifdef FEATURE_COMINTEROP
FCClassElement("ObjectMarshaler", "System.StubHelpers", gObjectMarshalerFuncs)
#endif
+#ifdef FEATURE_PAL
+FCClassElement("Ole32", "", gPalOle32Funcs)
+FCClassElement("OleAut32", "", gPalOleAut32Funcs)
+#endif
FCClassElement("OverlappedData", "System.Threading", gOverlappedFuncs)
diff --git a/tests/src/readytorun/CMakeLists.txt b/tests/src/readytorun/CMakeLists.txt
new file mode 100644
index 0000000000..88c0516360
--- /dev/null
+++ b/tests/src/readytorun/CMakeLists.txt
@@ -0,0 +1 @@
+add_subdirectory(tests)
diff --git a/tests/src/readytorun/tests/CMakeLists.txt b/tests/src/readytorun/tests/CMakeLists.txt
new file mode 100644
index 0000000000..19c217fd85
--- /dev/null
+++ b/tests/src/readytorun/tests/CMakeLists.txt
@@ -0,0 +1,6 @@
+include_directories( ${INC_PLATFORM_DIR} )
+set(SOURCES native.cpp)
+
+add_library(nativelibrary SHARED ${SOURCES})
+
+install(TARGETS nativelibrary DESTINATION bin)
diff --git a/tests/src/readytorun/tests/main.cs b/tests/src/readytorun/tests/main.cs
index bcadc37a3b..d8abe2810f 100644
--- a/tests/src/readytorun/tests/main.cs
+++ b/tests/src/readytorun/tests/main.cs
@@ -123,15 +123,7 @@ class Program
static void TestInterop()
{
- // Verify both intra-module and inter-module PInvoke interop
- if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
- {
- MyClass.GetTickCount();
- }
- else
- {
- MyClass.GetCurrentThreadId();
- }
+ MyClass.NativeMethod();
MyClass.TestInterop();
}
diff --git a/tests/src/readytorun/tests/mainv1.csproj b/tests/src/readytorun/tests/mainv1.csproj
index 5a58658cb1..4219444e49 100644
--- a/tests/src/readytorun/tests/mainv1.csproj
+++ b/tests/src/readytorun/tests/mainv1.csproj
@@ -28,6 +28,7 @@
<ProjectReference Include="testv1\test.csproj">
<Project>{F74F55A1-DFCF-4C7C-B462-E96E1D0BB667}</Project>
</ProjectReference>
+ <ProjectReference Include="CMakeLists.txt" />
</ItemGroup>
<ItemGroup>
<Compile Include="main.cs" />
diff --git a/tests/src/readytorun/tests/mainv2.csproj b/tests/src/readytorun/tests/mainv2.csproj
index f7752947db..985f7ca9ea 100644
--- a/tests/src/readytorun/tests/mainv2.csproj
+++ b/tests/src/readytorun/tests/mainv2.csproj
@@ -26,6 +26,7 @@
<ItemGroup>
<ProjectReference Include="fieldgetter.ilproj" />
<ProjectReference Include="testv1\test.csproj" />
+ <ProjectReference Include="CMakeLists.txt" />
</ItemGroup>
<ItemGroup>
<Compile Include="main.cs" />
diff --git a/tests/src/readytorun/tests/native.cpp b/tests/src/readytorun/tests/native.cpp
new file mode 100644
index 0000000000..cf02957e38
--- /dev/null
+++ b/tests/src/readytorun/tests/native.cpp
@@ -0,0 +1,6 @@
+#include <platformdefines.h>
+
+extern "C" int DLL_EXPORT NativeMethod()
+{
+ return 100;
+}
diff --git a/tests/src/readytorun/tests/test.cs b/tests/src/readytorun/tests/test.cs
index 508b369bae..585c30e057 100644
--- a/tests/src/readytorun/tests/test.cs
+++ b/tests/src/readytorun/tests/test.cs
@@ -147,22 +147,12 @@ public class MyClass : IMyInterface
#endif
}
- [DllImport("api-ms-win-core-sysinfo-l1-1-0.dll")]
- public extern static int GetTickCount();
-
- [DllImport("libcoreclr")]
- public extern static int GetCurrentThreadId();
+ [DllImport("nativelibrary")]
+ public extern static int NativeMethod();
static public void TestInterop()
{
- if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
- {
- GetTickCount();
- }
- else
- {
- GetCurrentThreadId();
- }
+ NativeMethod();
}
#if V2