Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
April 23, 2015 extern(C++) infer linkage from interface? | ||||
---|---|---|---|---|
| ||||
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); } |
April 24, 2015 Re: extern(C++) infer linkage from interface? | ||||
---|---|---|---|---|
| ||||
Posted in reply to bitwise | On Thursday, 23 April 2015 at 00:47:30 UTC, bitwise wrote:
> 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);
> }
Bump
|
April 25, 2015 Re: extern(C++) infer linkage from interface? | ||||
---|---|---|---|---|
| ||||
Posted in reply to bitwise | "bitwise" wrote in message news:op.xxishfi24sdys0@nicolass-macbook-pro.local... > 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? I think there's a bug report about this, somewhere. I'm not sure it's worth changing. |
April 26, 2015 Re: extern(C++) infer linkage from interface? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Daniel Murphy | On Sat, 25 Apr 2015 09:50:46 -0400, Daniel Murphy <yebbliesnospam@gmail.com> wrote:
> "bitwise" wrote in message news:op.xxishfi24sdys0@nicolass-macbook-pro.local...
>
>> 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?
>
> I think there's a bug report about this, somewhere. I'm not sure it's worth changing.
Ok, thanks for the info. I was wondering if there was some prohibitive reason that the behavior I'm requesting was not currently in force. I guess I'll dig around in bugzilla then, and file an enhancement request if one does not exist.
|
April 26, 2015 Re: extern(C++) infer linkage from interface? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Daniel Murphy | On Sat, 25 Apr 2015 09:50:46 -0400, Daniel Murphy <yebbliesnospam@gmail.com> wrote: > "bitwise" wrote in message news:op.xxishfi24sdys0@nicolass-macbook-pro.local... > >> 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? > > I think there's a bug report about this, somewhere. I'm not sure it's worth changing. For reference: https://issues.dlang.org/show_bug.cgi?id=13867 |
Copyright © 1999-2021 by the D Language Foundation