Are interfaces supported in Better C mode?
Dibyendu Majumdar
d.majumdar at gmail.com
Sun Nov 15 01:28:58 UTC 2020
On Sunday, 15 November 2020 at 01:00:27 UTC, kinke wrote:
> On Saturday, 14 November 2020 at 21:46:38 UTC, Dibyendu
> Majumdar wrote:
>> Well this compiles but doesn't link.
>
> This works with LDC:
>
> import core.stdc.stdio : printf;
>
> extern (C++) interface A {
> void sayHello();
> }
>
> extern (C++) class B : A {
> void sayHello() {
> printf("hello\n");
> }
> }
>
> extern (C) void main() {
> scope b = new B;
> b.sayHello();
> }
Hi,
I downloaded ldc2 1.24 and tried this out.
It compiled and linked okay - but crashes with segmentation fault
on the line that invokes the sayHello() method.
I am on RHEL 7.9.
Regards
More information about the Digitalmars-d
mailing list