retval

return-type function-name([outretval 
                                     [, optional-attributes]data-type * param-name)

Examples

HRESULT MyMethod([out, retval] InMyFace** ReturnVal);
HRESULT MyOtherMethod([out, retval] VARIANT_BOOL* ReturnVal);
 

Remarks

The retval attribute designates the parameter that receives the return value of the member. You can use this atttribute on parameters of interface members that describe methods or get properties. (The attribute is required on the last parameter of a method that has the propget attribute.) The parameter must have the out attribute and must be a pointer type.

You cannot apply the optional attribute to a retval parameter.

The MIDL compiler accepts the following parameter ordering (from left-to-right):

  1. Required parameters (parameters that do not have the defaultvalue or optional attributes),
  2. optional parameters with or without the defaultvalue attribute,
  3. parameters with the optional attribute and without the defaultvalue attribute,
  4. lcid parameter, if any,
  5. retval parameter

Parameters with the retval attribute are not displayed in user-oriented browsers.

Flags

IDLFLAG_FRETVAL

See Also

TYPEFLAGS, ODL File Syntax, ODL File Example, Generating a Type Library With MIDL, Differences Between MIDL and MKTYPLIB