ICLRRuntimeInfo::GetInterface Method

Loads the CLR into the current process and returns runtime interface pointers, such as ICLRRuntimeHost, ICLRStrongName, and IMetaDataDispenserEx.

This method supersedes all the CorBindTo* functions in the Deprecated CLR Hosting Functions section.


HRESULT GetInterface(  
[in]  REFCLSID rclsid,  
[in]  REFIID   riid,  
[out, iid_is(riid), retval] LPVOID *ppUnk);  


[in] The CLSID interface for the coclass.

[in] The IID of the requested rclsid interface.

[out] A pointer to the queried interface.

Return Value

This method returns the following specific HRESULTs as well as HRESULT errors that indicate method failure.

HRESULT Description
S_OK The method completed successfully.
E_POINTER ppUnk is null.
E_OUTOFMEMORY Not enough memory is available to handle the request.
CLR_E_SHIM_LEGACYRUNTIMEALREADYBOUND A different runtime was already bound to the legacy CLR version 2 activation policy.


This method causes the CLR to be loaded but not initialized.

The following table shows the supported combinations for rclsid and riid.

rclsid riid
CLSID_CorMetaDataDispenser IID_IMetaDataDispenser, IID_IMetaDataDispenserEx
CLSID_CorMetaDataDispenserRuntime IID_IMetaDataDispenser, IID_IMetaDataDispenserEx
CLSID_CorRuntimeHost IID_ICorRuntimeHost
CLSID_CLRRuntimeHost IID_ICLRRuntimeHost
CLSID_TypeNameFactory IID_ITypeNameFactory
CLSID_CLRDebuggingLegacy IID_ICorDebug
CLSID_CLRStrongName IID_ICLRStrongName


Platforms: See System Requirements.

Header: MetaHost.h

Library: Included as a resource in MSCorEE.dll

.NET Framework Versions: Available since 4

See also