digitalmars.D.learn - extern(C++) struct - what is it?
- Ilya Yaroshenko (8/8) Dec 16 2016 It was in DMD sources.
- Nicholas Wilson (19/27) Dec 16 2016 Like any other struct.
- Ilya Yaroshenko (3/8) Dec 16 2016 Thank you Nicholas
- Nicholas Wilson (4/12) Dec 16 2016 See also https://dlang.org/spec/cpp_interface.html in particular
It was in DMD sources. How it can be used? Are methods virtual? How multiple inheritance works? Can this be used in betterC mode? What different between classes in C++? Thanks, Ilya
Dec 16 2016
On Friday, 16 December 2016 at 12:40:19 UTC, Ilya Yaroshenko wrote:It was in DMD sources. How it can be used?Like any other struct.Are methods virtual?No.How multiple inheritance works?Don't think it works.Can this be used in betterC mode?Yes all it should affect is the mangling.What different between classes in C++?Mangling on MSVC is different for struct and classes, but other that that nothing I think. The difference in default visibility needs to be consistent regardless of class/struct. Do note that declaring extern(C++) class makes it a reference type, like all classes in D. Random other notes: If you're going in the D -> C++ direction, you control there should be no gotcha's. The other way round, you need to make sure that the symbol actually exists (if its a template, that it is instantiated). I think templates work in both directions, i.e. correct mangling coming from C++, and from D. I'm not sure that alias parameters work as they AFAIK don't have an analog in C++.Thanks, Ilya
Dec 16 2016
On Friday, 16 December 2016 at 13:02:11 UTC, Nicholas Wilson wrote:On Friday, 16 December 2016 at 12:40:19 UTC, Ilya Yaroshenko wrote:Thank you Nicholas[...]Like any other struct. [...]
Dec 16 2016
On Friday, 16 December 2016 at 12:40:19 UTC, Ilya Yaroshenko wrote:It was in DMD sources. How it can be used? Are methods virtual? How multiple inheritance works? Can this be used in betterC mode? What different between classes in C++? Thanks, IlyaSee also https://dlang.org/spec/cpp_interface.html in particular https://dlang.org/spec/cpp_interface.html#classes
Dec 16 2016