Add ImportC compiler to dmd

Adam D. Ruppe destructionator at gmail.com
Fri May 14 02:04:47 UTC 2021


On Friday, 14 May 2021 at 01:47:21 UTC, Chris Piker wrote:
> Though it's a separate issue, I hope this opens a path to mixed 
> C/D dub projects down the road.

This is already fairly easy to do. dub isn't great at it, but you 
can use a pre-build command in the dub settings to run make (or 
whatever) to build your C parts, then the D parts are built and 
they link seamlessly.

You can maintain your bindings by hand, or use dstep to build D 
bindings from C headers 90%ish reliably and dtoh to build C 
bindings from D files even better. It isn't actually that hard to 
do, but it can indeed be annoying if there's frequent changes to 
the interface.



More information about the Digitalmars-d mailing list