Can you access the same classes from C++ and D and vise versa, or do the classes have to not form dependency cycle?

Daniel Daniel
Sat Sep 10 20:04:35 UTC 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.




More information about the Digitalmars-d-learn mailing list