retval attribute

The [retval] attribute designates the parameter that receives the return value of the member.

return-type function-name(
    [out, retval [, optional-attributes]] data-type * param-name,
    ...);

Parameters

return-type

The data type of the return value of the remote procedure.

function-name

The name used to invoke the remote procedure.

optional-attributes

Zero or more MIDL attributes.

data-type

The type of the data passed through the parameter.

param-name

The identifier name of the parameter.

Remarks

You can use the [retval] attribute 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

Examples

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

See also

defaultvalue

Generating a Type Library With MIDL

lcid

ODL File Example

ODL File Syntax

optional

out

propget

TYPEFLAGS