Transforming a C/C++ project to D

Jacob Carlborg doob at me.com
Wed Mar 26 10:51:37 PDT 2014


On 2014-03-26 17:17, Russel Winder wrote:
> I may have missed something in Google searches but…
>
> I am looking at a GTK+2 project that was originally C, got transformed
> somewhat (and a bit badly) into a mix of C and C++. I can either move it
> the whole thing to C++14 or try to turn it into a D code. Revolutionary
> change is likely out of the question simply because it is a bigish
> project and too big an "elephant task". If however it is possible to
> incrementally move parts of the whole to D that is much more likely to
> happen.

Sure, it should be possible to incrementally move a project from C to D. 
It depends a bit on how the project structure looks like, but you should 
be able to port object files one at the time to D. Then link it with the 
rest of the object files.

You can use Adam D. Ruppe's tool dtoh, currently being reviewed [1], to 
create C bindings for D code. You can also use DStep [2] to create D 
bindings for the C code.

[1] http://forum.dlang.org/thread/lgspgg$2i8l$1@digitalmars.com
[2] https://github.com/jacob-carlborg/dstep

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list