Share via


struct

This statement defines a C-style structure.

Syntax

typedef [attributes] 
struct [tag] {
   memberlist
} structname;

attributes

The attributes helpstring, helpcontext, uuid, hidden, and version are accepted before a struct statement. The attributes helpstring, helpcontext, and string are accepted on a structure member. Attributes (including the brackets) can be omitted. If uuid is omitted, the structure is not specified uniquely in the system.

tag

An optional tag.

memberlist

The list of structure members defined with C syntax.

structname

The name by which the structure is known in the type library.

Remarks

The struct keyword must be preceded with a typedef. The structure description must precede other references to the structure in the library. Members of a struct can be of any built-in type, or any type defined lexically as a typedef before the struct. For a description of how strings and arrays can be entered, see the sections String Definitions and Array Definitions.

Example

typedef [uuid(BFB7334B-822A-1068-8849-00DD011087E8),
   helpstring("A task"), helpcontext(1019)]
struct {
   DATE startdate;
   DATE enddate;
   BSTR ownername;
   SAFEARRAY (int) subtasks;
   int A_C_array[10];
} TASKS;