Add ImportC compiler to dmd

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


On Monday, 10 May 2021 at 00:55:34 UTC, Adam D. Ruppe wrote:
> so i think dmd integration is a better approach than dpp.

That post was the positive side.

Here's what I said in the PR comment for the negative side:

This appears completely useless to me. First, it doesn't "just 
work" since you need to run cpp over the file before you can use 
it, and since that expands macros, it must be done for each 
different target, meaning it must be part of the build system. 
This offers no advantage over the (not great) existing solutions 
and shares many of their problems including creating huge files.

Even if that just worked, C bindings tend to rely on the 
preprocessor to do common and necessary tasks like defining 
constants. Without that, you can't even reasonably use real world 
C headers. Possibly a limited processor could translate them, but 
even that data is gone after cpp goes through it, so there's no 
real hope to recover it into a usable form.

I think trying to run the cpp over a whole D file like dpp does 
is problematic... but like something must be done. dstep's 
approach actually does a reasonably good job, at the cost of 
requiring a bit of hand editing and some setting up of other 
files too.

I do think there's some potential in integrating with dmd... but 
this PR as it is looks like more harm than good. And I'm not sure 
it is worth the time sink it will take to get it to a positive 
point.


======

Kinda the same thing: has potential but it is a lot of work to 
get it to actually realize that and there's other ways to get to 
that goal.

The preprocessor problem needs a solid action plan before we 
merge this thing or we'll be left with a half-done thing in limbo 
for years, if not forever.


More information about the Digitalmars-d mailing list