Provides one of three interfaces: ICLRMetaHost, ICLRMetaHostPolicy, or ICLRDebugging.
HRESULT CLRCreateInstance( [in] REFCLSID clsid, [in] REFIID riid, [out] LPVOID * ppInterface );
[in] One of three class identifiers: CLSID_CLRMetaHost, CLSID_CLRMetaHostPolicy, or CLSID_CLRDebugging.
[in] One of three interface identifiers (IIDs): IID_ICLRMetaHost, IID_ICLRMetaHostPolicy, or IID_ICLRDebugging.
[out] One of three interfaces: ICLRMetaHost, ICLRMetaHostPolicy, or ICLRDebugging.
This method returns the following specific HRESULTs as well as HRESULT errors that indicate method failure.
|S_OK||The method completed successfully.|
The following table shows the supported combinations for
The following code shows how to use
CLRCreateInstance to get all three interfaces:
#include <metahost.h> #pragma comment(lib, "mscoree.lib") ICLRMetaHost *pMetaHost = NULL; ICLRMetaHostPolicy *pMetaHostPolicy = NULL; ICLRDebugging *pCLRDebugging = NULL; HRESULT hr; hr = CLRCreateInstance(CLSID_CLRMetaHost, IID_ICLRMetaHost, (LPVOID*)&pMetaHost); hr = CLRCreateInstance (CLSID_CLRMetaHostPolicy, IID_ICLRMetaHostPolicy, (LPVOID*)&pMetaHostPolicy); hr = CLRCreateInstance (CLSID_CLRDebugging, IID_ICLRDebugging, (LPVOID*)&pCLRDebugging);
CreateInterface function is aliased to
CreateInterface functions can be used interchangeably. For example:
HMODULE hModule = LoadLibrary(L"mscoree.dll"); CreateInterfaceFnPtr createInterface = (CreateInterfaceFnPtr)GetProcAddress(hModule, "CreateInterface"); HRESULT hr; hr = createInterface(CLSID_CLRMetaHost, IID_ICLRMetaHost, (LPVOID*)&pMetaHost); hr = createInterface (CLSID_CLRMetaHostPolicy, IID_ICLRMetaHostPolicy, (LPVOID*)&pMetaHostPolicy); hr = createInterface (CLSID_CLRDebugging, IID_ICLRDebugging, (LPVOID*)&pCLRDebugging);
Platforms: See System Requirements.
Library: Included as a resource in MSCorEE.dll
.NET Framework Versions: Available since 4
Submit and view feedback for