1.1.0 ABI change for classes inheriting from interfaces

Johan Engelen via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Mon Nov 21 08:28:28 PST 2016


Hi all,
  I just discovered an important ABI change from 1.0.0 to 1.1.0.

For this code
```
interface I {
     void foo();
}

class A : I {
     int field;

     void foo() {}
}
```

1.0.0 generates the type:
     %abi.A = type { %abi.A.__vtbl*, i8*, i32, [4 x i8], { 
%object.Interface*, void (%abi.A*)* }* }
whereas 1.1.0 generates the type:
     %abi.A = type { %abi.A.__vtbl*, i8*, { %object.Interface*, 
void (%abi.A*)* }*, i32 }

Note that the location of the interface vtbl ptr was moved!

1.1.0 behavior is according to spec: 
https://dlang.org/spec/abi.html

-Johan






More information about the digitalmars-d-ldc mailing list