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
);

Parameters

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

  • szVersion
    [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.

  • pvReserved
    Reserved for future use.

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

Return Value

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

Return code

Description

S_OK

The method completed successfully.

CLR_E_SHIM_RUNTIMELOAD

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

Remarks

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

Note

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.

Requirements

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

See Also

Other Resources

.NET Framework 1.1 and 2.0 Hosting Global Static Functions