# CorBindToRuntimeHost Function

Enables hosts to load a specified version of the common language runtime (CLR) into a process.

This function has been deprecated in the .NET Framework 4.

## Syntax

HRESULT CorBindToRuntimeHost (
[in] LPCWSTR       pwszVersion,
[in] LPCWSTR       pwszBuildFlavor,
[in] LPCWSTR       pwszHostConfigFile,
[in] VOID*         pReserved,
[in] DWORD         startupFlags,
[in] REFCLSID      rclsid,
[in] REFIID        riid,
[out] LPVOID FAR  *ppv
);


## Parameters

pwszVersion
[in] A string that describes the version of the CLR you want to load.

A version number in the .NET Framework consists of four parts separated by periods: major.minor.build.revision. The string passed as pwszVersion must start with the character "v" followed by the first three parts of the version number (for example, "v1.0.1529").

Some versions of the CLR are installed with a policy statement that specifies compatibility with previous versions of the CLR. By default, the startup shim evaluates pwszVersion against policy statements and loads the latest version of the runtime that is compatible with the version being requested. A host can force the shim to skip policy evaluation and load the exact version specified in pwszVersion by passing a value of STARTUP_LOADER_SAFEMODE for the startupFlags parameter.

If pwszVersion is null, the method does not load any version of the CLR. Instead, it returns CLR_E_SHIM_RUNTIMELOAD, which indicates that it failed to load the runtime.

pwszBuildFlavor
[in] A string that specifies whether to load the server or the workstation build of the CLR. Valid values are svr and wks. The server build is optimized to take advantage of multiple processors for garbage collections, and the workstation build is optimized for client applications running on a single-processor machine.

If pwszBuildFlavor is set to null, the workstation build is loaded. When running on a single-processor machine, the workstation build is always loaded, even if pwszBuildFlavor is set to svr. However, if pwszBuildFlavor is set to svr and concurrent garbage collection is specified (see the description of the startupFlags parameter), the server build is loaded.

Note

Concurrent garbage collection is not supported in applications running the WOW64 x86 emulator on 64-bit systems that implement the Intel Itanium architecture (formerly called IA-64). For more information about using WOW64 on 64-bit Windows systems, see Running 32-bit Applications.

pwszHostConfigFile
[in] The name of a host configuration file that specifies the version of the CLR to load. If the file name does not include a fully qualified path, the file is assumed to be in the same directory as the executable that is making the call.

pReserved
[in] Reserved for future extensibility.

startupFlags
[in] A set of flags that controls concurrent garbage collection, domain-neutral code, and the behavior of the pwszVersion parameter. The default is single domain if no flag is set. For a list of supported values, see the STARTUP_FLAGS enumeration.

rclsid
[in] The CLSID of the coclass that implements either the ICorRuntimeHost or the ICLRRuntimeHost interface. Supported values are CLSID_CorRuntimeHost or CLSID_CLRRuntimeHost.

riid
[in] The IID of the interface you are requesting. Supported values are IID_ICorRuntimeHost or IID_ICLRRuntimeHost.

ppv
[out] An interface pointer to the version of the runtime that was loaded.

## Requirements

Platforms: See System Requirements.