Add ImportC compiler to dmd

Adam D. Ruppe destructionator at gmail.com
Mon May 10 02:12:02 UTC 2021


On Monday, 10 May 2021 at 01:45:22 UTC, Walter Bright wrote:
> 11. C++ can compile C code, which is a ginormous advantage for 
> C++. Can we afford not to do that?

You want to fully compile the C code, not just extract bindings 
to link to it?

There's a lot of convenience to that - I've translated many lines 
of code from C to D by hand (a pretty easy process btw, just 
tedious, but if you sit down for a few hours and just do it, it 
is a result you can use for years to come) to take advantage of 
the convenience; being able to dmd -i is nice.

But I think the binding aspect is a lot more important and 
without the preprocessor part you just can't do that. It is an 
absolute must for this to be useful.

If you can get some of that #define stuff to just work, then 
maybe we can merge this and iterate on it from there.

But I'm against merging something that's only maybe 20% done. Get 
up to 50% - integrated cpp with those #defines actually being 
available to D... and maybe we have something usable and a solid 
basis to estimate how much work is left (by the time you get to 
the point where you can do this, the work is about 1/3 done. 
There'd still the all the little details that need to be done and 
the inevitable flurry of bugs. I'd be surprised if this is 
legitimately usable by the end of the year. But it would prove it 
is realistically possible once importing a module with some 
defined constants works from the D side.)


More information about the Digitalmars-d mailing list