core.sys.windows.com.ComObject apparently has wrongly laid out Vtable

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Wed Mar 20 06:16:01 UTC 2024


On 20/03/2024 6:56 PM, Carl Sturtivant wrote:
> On Wednesday, 20 March 2024 at 05:42:29 UTC, Carl Sturtivant wrote:
>> What are the Vtable differences that cause an extern(C++) ComObject to 
>> work when calling AddRef when the druntime ComObject with 
>> extern(Windows) does not?
> 
> I mean this of course in the context of the code in my original post in 
> this thread.
> There casting a druntime ComObject to a pointer leads to a non-working 
> AddRef, but casting a extern(C++) ComObject to a pointer leads to a 
> working AddRef. I could speculate, but what are the actual rules 
> operating that lead to this?

The only difference I'm aware of between a class that inherits from 
IUnknown and extern(C++) should be the calling convention used for the 
functions in the vtable.

But your original code had a number of assumptions in it that weren't 
correct, so you should probably write a replacement first and work off 
of that.


More information about the Digitalmars-d mailing list