Fun with extern(C++)

Manu via Digitalmars-d digitalmars-d at puremagic.com
Tue Jan 26 08:13:55 PST 2016


On 27 January 2016 at 02:01, Jacob Carlborg via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
> On 2016-01-26 16:49, Manu via Digitalmars-d wrote:
>
>> I'm not sure there's a difference in the calling convention... the
>> function being called may perform adjustment of the 'this' pointer
>> such that it's correct relative to the class that implemented the
>> function, but that's internal to the function being called.
>
>
> Isn't the layout of the vtables different?

Probably, but the layout of the vtable is defined by the interface,
and the interface type is always known, so I don't see why there
should be any problem. Whether it's extern(C++) or extern(D), the
class populating the vtable with functions knows the layout.
I think it all comes down to this conversion to Object thing. If an
interface must do that, then that's probably an issue without jamming
an Object instance in the class somewhere.


More information about the Digitalmars-d mailing list