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,
...);
-
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.
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):
- Required parameters (parameters that do not have the [defaultvalue] or [optional] attributes).
- Optional parameters with or without the [defaultvalue] attribute.
- Parameters with the [optional] attribute and without the [defaultvalue] attribute.
- [lcid] parameter, if any.
- [retval] parameter.
Parameters with the [retval] attribute are not displayed in user-oriented browsers.
IDLFLAG_FRETVAL
HRESULT MyMethod([out, retval] InMyFace** ReturnVal);
HRESULT MyOtherMethod([out, retval] VARIANT_BOOL* ReturnVal);