can D compiler support C/C++ source code?

Rikki Cattermole via Digitalmars-d digitalmars-d at puremagic.com
Sun Sep 20 22:32:49 PDT 2015


On 21/09/15 5:24 PM, donglei wrote:
> While D is binary compatible with C code, it cannot compile C code nor C
> header files.
> In order to use C/C++ binary libs, I have to convert C or C++ header
> files to D module.
> It make very difficult to use C binary libs.
> Can D compiler support C/C++ source code in future?
> If can, it will become easy and convenient to use C/C++ libs in Dlang.
> Hope to achieve it as soon as possible!

What you are asking for is a c/c++ frontend as part of the D compiler, 
which is completely infeasible. There are attempts such as Calypso to 
use an existing c++ front end to generate D bindings. But even they have 
a hard time, especially with STL.

This is not going to happen. You will need to create bindings some way 
or another. They are easy and simple to do.


More information about the Digitalmars-d mailing list