Strange behavior
Jarrett Billingsley
kb3ctd2 at yahoo.com
Tue Mar 25 05:33:06 PDT 2008
"yvad" <yannurov at gmail.com> wrote in message
news:fsam2t$oo3$1 at digitalmars.com...
> And I get an error on line in AbstractClassFactory "HRESULT
> QueryInterface(in GUID* riid, out void* ppvObject) {":
> Severity and Description Path Resource Location Creation Time
> Id
> QueryInterface of type HRESULTWindows (GUID * riidriid, out void*
> ppvObject ppvObject) overrides but is not covariant with QueryInterface of
> type HRESULT(GUID * riidriid, void* ppvObject ppvObject)
> import/win32/api/com/interfaces IClassFactory.d line 28
> 1206420149328 12010
>
> if I comment line in AbstractUnknown with "HRESULT QueryInterface(in GUID*
> riid, out void* ppvObject);" it compiles without any error.
> Is it should be so or I am doing something wrong?
>
> I have this error on dmd 1.028 and 2.012 on Windows.
Before you go too far with this, you should know that while D has support
for COM, that support is kind of "magical." The interface you should be
inheriting has already been defined for you in std.c.windows.com. (There's
also some stuff in std.windows.iunknown but I'm not sure what that's for.)
In std.c.windows.com there's IUnknown and a class called ComObject which
implements it, including QueryInterface, AddRef, and Release. The compiler
explicitly depends upon you deriving from this IUnknown and I don't know if
it will treat your interfaces as COM interfaces unless you do.
More information about the Digitalmars-d-learn
mailing list