This documentation is archived and is not being maintained.

LoadLibraryShim Function

Loads a specified version of a DLL that is included in the .NET Framework redistributable package.

This function has been deprecated in the .NET Framework version 4. Use the ICLRRuntimeInfo::LoadLibrary method instead.

HRESULT LoadLibraryShim (
    [in]  LPCWSTR  szDllName,
    [in]  LPCWSTR  szVersion,
          LPVOID   pvReserved,
    [out] HMODULE *phModDll


[in] A zero-terminated string that represents the name of the DLL to be loaded from the .NET Framework library.


[in] A zero-terminated string that represents the version of the DLL to be loaded. If szVersion is null, the version selected for loading is the latest version of the specified DLL that is less than version 4. That is, all versions equal to or greater than version 4 are ignored if szVersion is null, and if no version less than version 4 is installed, the DLL fails to load. This is to ensure that installation of the .NET Framework 4 does not affect pre-existing applications or components. See the entry In-Proc SxS and Migration Quick Start in the CLR team blog.


Reserved for future use.


[out] A pointer to the handle of the module.

This method returns standard Component Object Model (COM) error codes, as defined in WinError.h, in addition to the following values.

Return code



The method completed successfully.


Loading szDllName requires loading the common language runtime (CLR), and the necessary version of the CLR cannot be loaded.

This function is used to load DLLs that are included in the .NET Framework redistributable package. It does not load user-generated DLLs.


Beginning with the .NET Framework version 2.0, loading Fusion.dll causes the CLR to be loaded. This is because the functions in Fusion.dll are now wrappers whose implementations are provided by the runtime.

Platforms: See .NET Framework System Requirements.

Header: MSCorEE.h

.NET Framework Versions: 4, 3.5 SP1, 3.5, 3.0 SP1, 3.0, 2.0 SP1, 2.0, 1.1, 1.0