ICLRMetaHost Interface

Provides methods that return a specific version of the common language runtime (CLR) based on its version number, list all installed CLRs, list all runtimes that are loaded in a specified process, discover the CLR version used to compile an assembly, exit a process with a clean runtime shutdown, and query legacy API binding.

Methods

Method

Description

ICLRMetaHost::EnumerateInstalledRuntimes Method

Returns an enumeration that contains a valid ICLRRuntimeInfo interface pointer for each CLR version that is installed on a computer.

ICLRMetaHost::EnumerateLoadedRuntimes Method

Returns an enumeration that contains a valid ICLRRuntimeInfo interface pointer for each CLR that is loaded in a given process. This method supersedes GetVersionFromProcess.

ICLRMetaHost::ExitProcess Method

Attempts to shut down all loaded runtimes gracefully and then terminates the process. Supersedes the CorExitProcess function.

ICLRMetaHost::GetRuntime Method

Gets the ICLRRuntimeInfo interface that corresponds to a particular CLR version. This method supersedes the CorBindToRuntimeEx function used with the STARTUP_LOADER_SAFEMODE flag.

ICLRMetaHost::GetVersionFromFile Method

Gets the assembly's original .NET Framework compilation version (stored in the metadata), given its file path. This method supersedes GetFileVersion.

ICLRMetaHost::QueryLegacyV2RuntimeBinding Method

Returns an interface that represents a runtime to which legacy activation policy has been bound, for example by using the useLegacyV2RuntimeActivationPolicy attribute on the <startup> Element configuration file entry, by direct use of the legacy activation APIs, or by calling the ICLRRuntimeInfo::BindAsLegacyV2Runtime method.

ICLRMetaHost::RequestRuntimeLoadedNotification Method

Guarantees a callback to the specified function pointer when a CLR version is first loaded, but not yet started. This method supersedes LockClrVersion

Remarks

The only way to get an instance of this interface is by calling the CLRCreateInstance function as follows:

ICLRMetaHost *pMetaHost = NULL;
HRESULT hr = CLRCreateInstance(CLSID_CLRMetaHost,
                   IID_ICLRMetaHost, (LPVOID*)&pMetaHost);

Requirements

Platforms: See .NET Framework System Requirements.

Header: MetaHost.h

Library: Included as a resource in MSCorEE.dll

.NET Framework Versions: 4

See Also

Other Resources

Hosting Interfaces

Hosting (Unmanaged API Reference)