I have a class with callbacks that can be overridden, which are inherited from an extern(C++) interface. The callbacks are called from C++ code. Is there any chance that the linkage will be inferred in the future?

To be clear, couldn't the extern(C++) just be inferred in the class 'MyTest' below?

extern(C++) {
    interface Test {
        void Foo();
    }

    void register(Test test);
    void unregister(Test test);
}

class MyTest : Test {
    extern(C++) {     // seemingly unnecessary boilerplate
        void Foo() {
            writeln("foo");
        }
    }
}

void main() {
    MyTest test = new MyTest();
    register(test);
    while(...) {}
    unregister(test);
}

Reply via email to