summaryrefslogtreecommitdiff
path: root/src/dlls
diff options
context:
space:
mode:
authorKonstantin Baladurin <k.baladurin@samsung.com>2019-07-05 19:36:28 +0300
committer이형주/Common Platform Lab(SR)/Staff Engineer/삼성전자 <leee.lee@samsung.com>2019-10-15 06:54:39 +0900
commit5647236eac21fb0e01a55a12289a66bc9f874f19 (patch)
treef81eede622d29edc955cf9fe3d5dcb670ec95675 /src/dlls
parentc4c19b84a37bbc750e2cc13570dd096b13abfff0 (diff)
downloadcoreclr-accepted/tizen/5.5/unified/mobile/hotfix/20201027.061818.tar.gz
coreclr-accepted/tizen/5.5/unified/mobile/hotfix/20201027.061818.tar.bz2
coreclr-accepted/tizen/5.5/unified/mobile/hotfix/20201027.061818.zip
Diffstat (limited to 'src/dlls')
-rw-r--r--src/dlls/mscoree/mscorwks_ntdef.src1
-rw-r--r--src/dlls/mscoree/mscorwks_unixexports.src1
-rw-r--r--src/dlls/mscoree/unixinterface.cpp42
3 files changed, 42 insertions, 2 deletions
diff --git a/src/dlls/mscoree/mscorwks_ntdef.src b/src/dlls/mscoree/mscorwks_ntdef.src
index bdbce4f4c6..3611e0c140 100644
--- a/src/dlls/mscoree/mscorwks_ntdef.src
+++ b/src/dlls/mscoree/mscorwks_ntdef.src
@@ -20,6 +20,7 @@ EXPORTS
CLRJitAttachState @3 data
; Unix hosting API
+ coreclr_preload_assembly
coreclr_create_delegate
coreclr_execute_assembly
coreclr_initialize
diff --git a/src/dlls/mscoree/mscorwks_unixexports.src b/src/dlls/mscoree/mscorwks_unixexports.src
index 6ba08c9af8..ddbe76b3e9 100644
--- a/src/dlls/mscoree/mscorwks_unixexports.src
+++ b/src/dlls/mscoree/mscorwks_unixexports.src
@@ -1,4 +1,5 @@
; Unix hosting API
+coreclr_preload_assembly
coreclr_create_delegate
coreclr_execute_assembly
coreclr_initialize
diff --git a/src/dlls/mscoree/unixinterface.cpp b/src/dlls/mscoree/unixinterface.cpp
index 67bd444ba8..7cbfad048a 100644
--- a/src/dlls/mscoree/unixinterface.cpp
+++ b/src/dlls/mscoree/unixinterface.cpp
@@ -146,6 +146,34 @@ extern "C" int coreclr_create_delegate(void*, unsigned int, const char*, const c
#endif //FEATURE_GDBJIT
//
+// Preload native assembly.
+//
+// This method allows to preload assembly to memory and apply relocations before initialization of CoreCLR.
+// Assemblies are stored in the list, which is scanned during general loading after CoreCLR initialization.
+// If path is found in the list, preloaded memory is used.
+// If CoreCLR is already initialized, it returns E_FAIL.
+//
+// Parameters:
+// assemblyPath - Absolute path of the assembly to preload
+//
+// Returns:
+// HRESULT indicating status of the operation. S_OK if the assembly was successfully preloaded
+//
+extern "C"
+DLLEXPORT
+int coreclr_preload_assembly(
+ const char *assemblyPath
+)
+{
+ if (assemblyPath == NULL)
+ {
+ return E_FAIL;
+ }
+
+ return CorHost2::PreloadAssembly(assemblyPath);
+}
+
+//
// Initialize the CoreCLR. Creates and starts CoreCLR host and creates an app domain
//
// Parameters:
@@ -288,7 +316,12 @@ int coreclr_shutdown(
{
ReleaseHolder<ICLRRuntimeHost4> host(reinterpret_cast<ICLRRuntimeHost4*>(hostHandle));
- HRESULT hr = host->UnloadAppDomain(domainId, true); // Wait until done
+ HRESULT hr;
+
+ hr = CorHost2::UnloadPreloadedAssemblies();
+ IfFailRet(hr);
+
+ hr = host->UnloadAppDomain(domainId, true); // Wait until done
IfFailRet(hr);
hr = host->Stop();
@@ -320,7 +353,12 @@ int coreclr_shutdown_2(
{
ReleaseHolder<ICLRRuntimeHost4> host(reinterpret_cast<ICLRRuntimeHost4*>(hostHandle));
- HRESULT hr = host->UnloadAppDomain2(domainId, true, latchedExitCode); // Wait until done
+ HRESULT hr;
+
+ hr = CorHost2::UnloadPreloadedAssemblies();
+ IfFailRet(hr);
+
+ hr = host->UnloadAppDomain2(domainId, true, latchedExitCode); // Wait until done
IfFailRet(hr);
hr = host->Stop();