Pointer-Attribute Type Inheritance

According to the DCE specification, each IDL file must define attributes for its pointers. If an explicit attribute is not assigned to a pointer, the pointer uses the value specified by the pointer_default keyword. Some DCE implementations do not allow unattributed pointers. If a pointer does not have an explicit attribute, the IDL file must have a pointer_default specification so the pointer attribute can be set.

In default (Microsoft-extensions) mode, you can specify a pointer's attribute in the IDL file that imports the defining IDL file. Pointers defined in one IDL file can inherit attributes that are specified in other IDL files.

Also in default mode, IDL files can include unattributed pointers. If neither the base nor the imported IDL files specify a pointer attribute or pointer_default, unattributed pointers are interpreted as unique pointers.

The MIDL compiler assigns pointer attributes to pointers using the following priority rules (1 is highest):

  1. Explicit pointer attributes explicitly applied to the pointer at the definition or use site.
  2. Pointer_default attribute in the IDL file that defines the type.
  3. Pointer_default attribute in the IDL file that imports the type.
  4. Ptr (DCE-compatibility mode); unique (Microsoft-extensions mode).