Skip to content

Latest commit

 

History

History
38 lines (28 loc) · 2.07 KB

File metadata and controls

38 lines (28 loc) · 2.07 KB
title Compiler COM Support | Microsoft Docs
ms.custom
ms.date 11/04/2016
ms.technology
cpp-language
ms.topic language-reference
dev_langs
C++
helpviewer_keywords
cl.exe compiler, COM support
COM, compiler support
ms.assetid 76a78442-f2a4-4985-9967-67e20773f847
author mikeblome
ms.author mblome
ms.workload
cplusplus

Compiler COM Support

Microsoft Specific

The Visual C++ compiler can directly read component object model (COM) type libraries and translate the contents into C++ source code that can be included in the compilation. Language extensions are available to facilitate COM programming on the client side.

By using the #import preprocessor directive, the compiler can read a type library and convert it into a C++ header file that describes the COM interfaces as classes. A set of #import attributes is available for user control of the content for the resulting type library header files.

You can use the __declspec extended attribute uuid to assign a globally unique identifier (GUID) to a COM object. The keyword __uuidof can be used to extract the GUID associated with a COM object. Another __declspec attribute, property, can be used to specify the get and set methods for a data member of a COM object.

A set of COM support global functions and classes is provided to support the VARIANT and BSTR types, implement smart pointers, and encapsulate the error object thrown by _com_raise_error:

END Microsoft Specific

See Also

Compiler COM Support Classes
Compiler COM Global Functions