extern(C++) infer linkage from interface?
bitwise via Digitalmars-d
digitalmars-d at puremagic.com
Wed Apr 22 17:47:29 PDT 2015
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);
}
More information about the Digitalmars-d
mailing list