www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Can you access the same classes from C++ and D and vise versa, or do

reply Daniel Donnell, Jr <fruitfulapproach gmail.com> writes:
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.
Sep 10 2022
next sibling parent reply =?UTF-8?Q?Ali_=c3=87ehreli?= <acehreli yahoo.com> writes:
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
Sep 10 2022
parent reply zjh <fqbqrr 163.com> writes:
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.
Sep 10 2022
parent reply Daniel Donnell, Jr <fruitfulapproach gmail.com> writes:
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...
Sep 12 2022
parent Tejas <notrealemail gmail.com> writes:
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
Sep 13 2022
prev sibling parent Sergey <kornburn yandex.ru> writes:
Pretty new video from ContextFreeCode covers interop with C++
D also mentioned there :)

https://youtu.be/RdypYCxhWtw
Sep 12 2022