[WinAPI] Problem with an interface...
Sascha Katzner
sorry.no at spam.invalid
Thu Nov 22 09:35:48 PST 2007
Sascha Katzner wrote:
> But IUnknown itself is declared as an D interface:
>
> com.d:
>> interface IUnknown
>> {
>> HRESULT QueryInterface(IID* riid, void** pvObject);
>> ULONG AddRef();
>> ULONG Release();
>> }
>
> ...or is this only some kind of false front, and the real implementation
> is hidden behind some compiler magic?
I've found something...
internal\object.d:
> /**
> * Information about an interface.
> * A pointer to this appears as the first entry in the interface's vtbl[].
> */
> struct Interface
> {
> ClassInfo classinfo; /// .classinfo for this interface (not for containing class)
> void *[] vtbl;
> int offset; /// offset to Interface 'this' from Object 'this'
> }
It seems this explains exactly why the next function is called (because
D expects an additional first entry which Windows doesn't deliver), when
using a normal D interface instead of something derived from IUnknown.
What it doesn't explain is, why IUnknown interfaces doesn't have this
problem?!?
LLAP,
Sascha Katzner
More information about the Digitalmars-d
mailing list