Compililng C++ and D together without going mad

Jan Hönig hrominium at gmail.com
Wed Apr 29 13:02:36 UTC 2020


On Wednesday, 29 April 2020 at 11:38:16 UTC, Johan wrote:
> LDC is a (somewhat complex) project with D and C++ code (and 
> external C++ libraries).
> I think it will help you if your main() is in D (such that 
> druntime is automatically initialized for you).
> https://github.com/ldc-developers/ldc
>
> -Johan

Hmmm, a D main means i need to do quite some C++ bindings, with 
which I have 0 experience. I cannot even say if it will be 
possible.

I will probably need:
https://github.com/jupyter-xeus/xeus/blob/master/include/xeus/xkernel.hpp
https://github.com/jupyter-xeus/xeus/blob/master/include/xeus/xkernel_configuration.hpp
c++ stdlib's unique_ptr.
And then i need to subclass a C++ class and extern this D 
subclass.

It sounds easier to me, to manually initialize D's runtime (i 
imagine it being some function calls), build everything with C++, 
and just call D functions from C++.

Or do you think it is worth the hassle with bindings?

I have done C++ bindings once,years ago in python and it was a 
not pleasent.


More information about the Digitalmars-d-learn mailing list