I'm not sure whether this is new in WinRT or existed before; in IDL, you can write declarations like this:
[uuid(E9C62AEE-1494-4A21-BB7E-8589FC751D9D)]
[version(0x06020000)]
[exclusiveto(Windows.Networking.Sockets.DatagramSocket)]
interface IDatagramSocketStatics : IInspectable
{
[overload("GetEndpointPairsAsync")] HRESULT GetEndpointPairsAsync(
[in] Windows.Networking.HostName* remoteHostName,
[in] HSTRING remoteServiceName,
[out] [retval] Windows.Foundation.IAsyncOperation
<Windows.Foundation.Collections.IVectorView
<Windows.Networking.EndpointPair*>*>** operation);
[overload("GetEndpointPairsAsync")] HRESULT GetEndpointPairsWithSortOptionsAsync(
[in] Windows.Networking.HostName* remoteHostName,
[in] HSTRING remoteServiceName,
[in] Windows.Networking.HostNameSortOptions sortOptions,
[out] [retval] Windows.Foundation.IAsyncOperation
<Windows.Foundation.Collections.IVectorView<
<Windows.Networking.EndpointPair*>*>** operation);
}
The intention apparently is that the WinRT operation "GetEndpointPairAsync" is overloaded twice, once as GetEndpointPairsAsync, and once as GetEndpointPairsWithSortOptionsAsync.
Is it possible to learn the two underlying operation names through IMetaDataImport? I need to find out in order to generate C code which calls these methods, and all I get from EnumMethods is the overloaded name.
Overloaded members will have the OverloadAttribute
custom attribute, which specifies the unique name of the overload.
You can call IMetaDataImport::EnumCustomAttributes
to enumerate the custom attributes of a method definition (MethodDef), identify the OverloadAttribute
if one is present, and parse its string argument to get the unique name.