D vs Zig

Sergey kornburn at yandex.ru
Sat Dec 6 22:08:25 UTC 2025


On Saturday, 6 December 2025 at 21:24:52 UTC, Walter Bright wrote:
> D also supports the C++ name mangling, which means D can call 
> C++ functions.

This functionality pretty hard to work with.

I've tried to use it for one C++ library and finished with the 
approach of manually prepared C API for C++ API and ImportC. It 
worked much better approach.

Examples are here
https://github.com/cyrusmsk/gguf-converter/tree/main/libs_tests

Simple C++ interop was working with D (separate folder where I've 
tried to compare this with popular ML/AI langs).

But when I tried to use it with real C++ library (sentencepiece) 
that I wanted to use (sp folder) - it failed with C++.

It was non-straightforward how to define namespaces and how to 
work with string_views.


If anyone could fix this C++ library - would be interesting to 
see.


More information about the Digitalmars-d mailing list