Edit

Share via


implementation_only import attribute

C++ Specific

Suppresses the generation of the .tlh primary type-library header file.

Syntax

#import type-library implementation_only

Remarks

This file contains all the declarations used to expose the type-library contents. The .tli header file, with the implementations of the wrapper member functions, will be generated and included in the compilation.

When this attribute is specified, the content of the .tli header is in the same namespace as the one normally used in the .tlh header. In addition, the member functions are not declared as inline.

The implementation_only attribute is intended for use in conjunction with the no_implementation attribute as a way of keeping the implementations out of the precompiled header (PCH) file. An #import statement with the no_implementation attribute is placed in the source region used to create the PCH. The resulting PCH is used by a number of source files. An #import statement with the implementation_only attribute is then used outside the PCH region. You're required to use this statement only once in one of the source files. It generates all the required wrapper member functions without additional recompilation for each source file.

Note

The implementation_only attribute in one #import statement must be used in conjunction with another #import statement, of the same type library, with the no_implementation attribute. Otherwise, compiler errors are generated. This is because wrapper class definitions generated by the #import statement with the no_implementation attribute are required to compile the implementations generated by the implementation_only attribute.

END C++ Specific

See also

#import attributes
#import directive