Thread overview
Can you access the same classes from C++ and D and vise versa, or do the classes have to not form dependency cycle?
Sep 10, 2022
Daniel Donnell, Jr
Sep 10, 2022
Ali Çehreli
Sep 11, 2022
zjh
Sep 13, 2022
Daniel Donnell, Jr
Sep 14, 2022
Tejas
Sep 12, 2022
Sergey
September 10, 2022

https://dlang.org/spec/cpp_interface.html

According to that C++ / D .object files can interoperate both ways, but one has to be compiled before the other, order depending on direction.

My question is, can you have a class C (C++) use a class D (Dlang) in such a way that D can also use C as in the article?

I'm guessing using all pointers on the C++ side might work. I have never gotten rid of cyclical dependencies in C++ other than putting a bunch of classes in the same file, but in D, cyclic dependency is resolved beautifully somehow, so I can split up my classes into each their own d-module.

September 10, 2022
On 9/10/22 13:04, Daniel Donnell wrote:
> https://dlang.org/spec/cpp_interface.html

At DConf, Manu indicated that that page is outdated and that D's C++ support is actually a lot better. He kind-of-promised to update that page but I doubt it happened yet if ever. :)

> one has to be compiled before the other, order depending on direction.

I don't think that's correct. The page is unfortunately unclear:

  "the first with a C++ compiler, the second with a D compiler"

could have better been written as

  "the C++ source file with a C++ compiler, and the D source file with a D compiler"

Ali

September 11, 2022
On Saturday, 10 September 2022 at 22:07:32 UTC, Ali Çehreli wrote:
> On 9/10/22 13:04, Daniel Donnell wrote:
> > https://dlang.org/spec/cpp_interface.html
>
> At DConf, Manu indicated that that page is outdated and that D's C++ support is actually a lot better.


Update it quickly, This is a big selling point.
September 12, 2022

Pretty new video from ContextFreeCode covers interop with C++
D also mentioned there :)

https://youtu.be/RdypYCxhWtw

September 13, 2022
On Sunday, 11 September 2022 at 02:14:51 UTC, zjh wrote:
> On Saturday, 10 September 2022 at 22:07:32 UTC, Ali Çehreli wrote:
>> On 9/10/22 13:04, Daniel Donnell wrote:
>> > https://dlang.org/spec/cpp_interface.html
>>
>> At DConf, Manu indicated that that page is outdated and that D's C++ support is actually a lot better.
>
>
> Update it quickly, This is a big selling point.

So what is the answer here?  I'm not sure what they were getting at...
September 14, 2022

On Tuesday, 13 September 2022 at 03:13:59 UTC, Daniel Donnell, Jr wrote:

>

On Sunday, 11 September 2022 at 02:14:51 UTC, zjh wrote:

>

On Saturday, 10 September 2022 at 22:07:32 UTC, Ali Çehreli wrote:

>

On 9/10/22 13:04, Daniel Donnell wrote:

>

https://dlang.org/spec/cpp_interface.html

At DConf, Manu indicated that that page is outdated and that D's C++ support is actually a lot better.

Update it quickly, This is a big selling point.

So what is the answer here? I'm not sure what they were getting at...

You can

https://stackoverflow.com/a/53710273