LoadTypeLibWithResolver Function

Loads a type library and uses the supplied ITypeLibResolver interface to resolve any internally referenced type libraries.

HRESULT LoadTypeLibWithResolver(
    [in]  LPCOLESTR           szFile,
    [in]  REGKIND             regkind,
    [in]  ITypeLibResolver   *pTlbResolver,
    [out] ITypeLib          **pptlib);


[in] The file path of the type library.


[in] A REGKIND Enumeration enumeration flag that controls how the type library is registered. Its possible values are as follows:

  • REGKIND_DEFAULT: Use default registration behavior.

  • REGKIND_REGISTER: Register this type library.

  • REGKIND_NONE: Do not register this type library.


[in] A pointer to the implementation of the ITypeLibResolver interface.


[out] A reference to the type library that is being loaded.

One of the HRESULT values listed in the following table.

Return value





Out of memory.


One or more of the pointers are invalid.


One or more of the arguments are invalid.


The function could not write to the file.


The system registration database could not be opened.


The type library could not be opened.


The type library or DLL could not be loaded.

The Tlbexp.exe (Type Library Exporter) calls the LoadTypeLibWithResolver function during the assembly-to-type-library conversion process.

This function loads the specified type library with minimal access to the registry. The function then examines the type library for internally referenced type libraries, each of which must be loaded and added to the parent type library.

Before a referenced type library can be loaded, its reference file path must be resolved to a full file path. This is accomplished through the ResolveTypeLib method that is provided by the ITypeLibResolver interface, which is passed in the pTlbResolver parameter.

When the full file path of the referenced type library is known, the LoadTypeLibWithResolver function loads and adds the referenced type library to the parent type library, creating a combined master type library.

After the function resolves and loads all internally referenced type libraries, it returns a reference to the master resolved type library in the pptlib parameter.

The LoadTypeLibWithResolver function is generally called by the Tlbexp.exe (Type Library Exporter), which supplies its own internal ITypeLibResolver interface implementation in the pTlbResolver parameter.

If you call LoadTypeLibWithResolver directly, you must supply your own ITypeLibResolver interface implementation.

Platforms: See .NET Framework System Requirements.

Header: TlbRef.h

Library: TlbRef.lib

.NET Framework Version: 3.5, 3.0, 2.0

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2015 Microsoft