interface DECLSPEC_UUID("ac6b7889-0740-4d51-8619-905994a55cc6") DECLSPEC_NOVTABLE
IRtwqAsyncResult : public IUnknown
{
STDMETHOD(GetState)( _Out_ IUnknown** ppunkState);
STDMETHOD(GetStatus)();
STDMETHOD(SetStatus)( HRESULT hrStatus);
STDMETHOD(GetObject)( _Out_ IUnknown ** ppObject);
STDMETHOD_(IUnknown *, GetStateNoAddRef)();
};
interface DECLSPEC_UUID("a27003cf-2354-4f2a-8d6a-ab7cff15437e") DECLSPEC_NOVTABLE
IRtwqAsyncCallback : public IUnknown
{
STDMETHOD(GetParameters)( _Out_ DWORD* pdwFlags, _Out_ DWORD* pdwQueue );
STDMETHOD(Invoke)( _In_ IRtwqAsyncResult* pAsyncResult );
};
Interface methods lack pure specifiers. This might be OK for some development but once you try to inherit your handler class from public winrt::implements<AsyncCallback, IRtwqAsyncCallback>
you are in trouble!
1>Foo.obj : error LNK2001: unresolved external symbol "public: virtual long __cdecl IRtwqAsyncCallback::GetParameters(unsigned long *,unsigned long *)" (?GetParameters@IRtwqAsyncCallback@@UEAAJPEAK0@Z) 1>Foo.obj : error LNK2001: unresolved external symbol "public: virtual long __cdecl IRtwqAsyncCallback::Invoke(struct IRtwqAsyncResult *)" (?Invoke@IRtwqAsyncCallback@@UEAAJPEAUIRtwqAsyncResult@@@Z)
The problem exists in current Windows 10 SDK and since 10.0.18362.0 at the very least.
To work it around without touching SDK code, this project side addition would satisfy the compiler:
IFACEMETHODIMP IRtwqAsyncCallback::GetParameters([[maybe_unused]] DWORD* Flags, [[maybe_unused]] DWORD* Queue)
{
std::terminate();
return E_NOTIMPL;
}
IFACEMETHODIMP IRtwqAsyncCallback::Invoke([[maybe_unused]] IRtwqAsyncResult* AsyncResult)
{
std::terminate();
return E_NOTIMPL;
}