This attribute exposes type library CUSTDATA elements. Callers may query a class's type library at runtime (such as through IProvideClassInfo) for these attributes using methods like ITypeInfo2::GetCustData.
Attribute Level | Generated By Directives |
Class | @com.transaction @com.typeinfo |
COM_CustData_attribute { u2 attribute_name_index; u4 attribute_length; u2 nCustDatas; { u2 GuidIndex; u2 DataIndex; } aCustData[nCustDatas]; }
The C structure MCCustData, declared in comattr.h, defines the layout of this attribute for use in C/C++ programs.
The @com.transaction directive that generates this attribute has the following syntax:
/** @com.transaction(required | requiresNew | supported | notSupported) */
These four possible parameters get converted to well-known GUIDs (see the following table).
The @com.typeinfo directive indicates a GUID and its data value where the value can be an int, long, float, double, or string data type. Raw data is expressed using Unicode escape sequences. This directive can exist in two syntax forms:
/** @com.typeinfo(attrid=GUID, value=number | string) */ /** @com.typeinfo({GUID}=number | string) */
For example, the following are valid directives:
/** @com.typeinfo(attrid=17093CC7-9BD2-11CF-AA4F-304BF89C0001, value="\u1234\u7689\u00AF")*/ /** @com.typeinfo({17093CC7-9BD2-11CF-AA4F-304BF89C0001}=0) */
The parameter options for the @com.transaction directive get converted to the well-known GUIDs as shown in the following table.
Parameter to @com.transaction | Well-Known GUID | Comments |
requiresNew | 17093CC7-9BD2-11cf-AA4F-304BF89C0001 | TLBATTR_TRANS_REQNEW |
required | 17093CC5-9BD2-11cf-AA4F-304BF89C0001 | TLBATTR_TRANS_required |
supported | 17093CC8-9BD2-11cf-AA4F-304BF89C0001 | TLBATTR_TRANS_supported |
notSupported | 17093CC6-9BD2-11cf-AA4F-304BF89C0001 | TLBATTR_TRANS_NOTSUPP |
The effect of the @com.transaction directive with one of these parameters is equivalent to an @com.typeinfo directive with these well-known GUIDs entered. For example, the following two directives create identical COM_CustData attribute items:
/** @com.transaction(requiresNew) */ /** @com.typeinfo({17093CC7-9BD2-11cf-AA4F-304BF89C0001}=0) */
An @com.register directive must be specified if an @com.transaction or @com.typeinfo directive is present.
The class access flags must be a subset of ACC_PUBLIC, ACC_FINAL, ACC_INTERFACE, or ACC_ABSTRACT.
attribute_name_index
This value must be a valid index into the constant pool table. The constant pool entry at that index must be the CONSTANT_Utf8_info structure representing the string "COM_CustData".
attribute_length
This value indicates the length of this attribute, excluding the initial six bytes, and varies depending on the value of nCustDatas.
aCustData[]
GuidIndex
Index into the COM_GuidPool attribute table. The value indexed in this table represents the GUID identity for this custom data element.
DataIndex
Index into this class's constant_pool. Only CP_Utf8 and CP_Integer constant pool entries are currently supported.
nCustDatas
The number of aCustData items defined in this table.