Thread overview
extern(C++) struct - what is it?
Dec 16, 2016
Ilya Yaroshenko
Dec 16, 2016
Nicholas Wilson
Dec 16, 2016
Ilya Yaroshenko
Dec 16, 2016
Nicholas Wilson
December 16, 2016
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
December 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

December 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,
> Ilya

See also https://dlang.org/spec/cpp_interface.html in particular https://dlang.org/spec/cpp_interface.html#classes
December 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:
>> [...]
>
> Like any other struct.
>
> [...]

Thank you  Nicholas