Düzenle

Aracılığıyla paylaş


importlib attribute

The [importlib] directive makes types that have already been compiled into another type library available to the type library being created.

[
    library-attributes
]
library (library-name)
{
    importlib(file-to-import); 
    ... 
}

Parameters

library-attributes

Zero or more attributes that will be applied to the library.

library-name

The identifier that software components will use to denote this library.

file-to-import

The name and location of the imported file at MIDL compile-time.

Remarks

All [importlib] directives must precede the other type descriptions in the library. Note that the imported library, as well as the generated library, must be distributed with the application so that it is available at run time.

In most cases you should use the MIDL [import] directive to reference definitions from another .IDL file in your .IDL file. This method provides your type library with all the information from the original file, whereas [importlib] only brings in the contents of the type library.

Note

The [importlib] directive makes any type defined in the imported library accessible from within the library being compiled. To avoid ambiguity when there are duplicate references, we recommend that you qualify each such reference with the appropriate library name, as follows:

 

library_name.type

In the absence of such qualification, MIDL resolves duplicate reference ambiguity as follows:

  • Effective with version 3.1, MIDL uses the first reference it finds.
  • Version 3.0 of MIDL, the first version of MIDL that could generate type libraries, uses the last reference it found.

Examples

library BrowseHelper 
{ 
    importlib("stdole32.tlb"); 
    importlib("mydisp.tlb"); 
    //Remainder of library definition 
};

See also

library

import

Importing System Header Files

Importing Files and Type Libraries

ODL File Syntax

ODL File Example

Generating a Type Library With MIDL