diff options
author | Konstantin Baladurin <k.baladurin@samsung.com> | 2019-07-05 19:36:28 +0300 |
---|---|---|
committer | Gleb Balykov <g.balykov@samsung.com> | 2020-03-25 15:29:41 +0300 |
commit | adf89f8ad08eaf477b768d76d3902d123fd916e2 (patch) | |
tree | a0551deaf0b3d1f996b40366ef72ea7b11d8207b /src/dlls/mscoree/unixinterface.cpp | |
parent | c6b150319647712f3bd1340fcc051336fbabb424 (diff) | |
download | coreclr-adf89f8ad08eaf477b768d76d3902d123fd916e2.tar.gz coreclr-adf89f8ad08eaf477b768d76d3902d123fd916e2.tar.bz2 coreclr-adf89f8ad08eaf477b768d76d3902d123fd916e2.zip |
[Tizen] Add coreclr_preload_assembly to CoreCLR host API
Diffstat (limited to 'src/dlls/mscoree/unixinterface.cpp')
-rw-r--r-- | src/dlls/mscoree/unixinterface.cpp | 42 |
1 files changed, 40 insertions, 2 deletions
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(); |