return-type function-name([out, retval
[, optional-attributes]] data-type * param-name)
HRESULT MyMethod([out, retval] InMyFace** ReturnVal);
HRESULT MyOtherMethod([out, retval] VARIANT_BOOL* ReturnVal);
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):
Parameters with the retval attribute are not displayed in user-oriented browsers.
IDLFLAG_FRETVAL
TYPEFLAGS, ODL File Syntax, ODL File Example, Generating a Type Library With MIDL, Differences Between MIDL and MKTYPLIB