C++ interface vs D and com

Adam Sansier via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jul 12 14:24:27 PDT 2016


On Tuesday, 12 July 2016 at 15:13:02 UTC, Adam D. Ruppe wrote:
> On Tuesday, 12 July 2016 at 15:09:26 UTC, Adam Sansier wrote:
>> I marked the interface extern(C++) so it's a C++ style 
>> interface.
>>  The first field of a COM object is a pointer to its vtable.
>
> If it is a COM interface, you should make it a COM interface by 
> inheriting from IUnknown.
>
> http://dlang.org/spec/interface.html#com-interfaces

Obviously... doesn't help.

There is some weirdness with the vtable.

In the C++ version it is a simple list of void*'s starting at 
offset 0. In the D version I haven't figured out what is going on 
yet. Might just be a simple mistake on my part but something 
seems aloof. I will continue to work on it, it is difficult 
without being able to really see what is going on through proper 
debugging support though and not knowing how D does things 
differently than C++ under the hood.







More information about the Digitalmars-d-learn mailing list