Add ImportC compiler to dmd
12345swordy
alexanderheistermann at gmail.com
Mon May 10 00:47:08 UTC 2021
> On Sunday, 9 May 2021 at 22:41:23 UTC, Adam D. Ruppe wrote in
> github:
>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.
The advantage of having this built into the compiler itself is
that you don't have to rely on a third party library for
importing c functions into your d code. Accessibility is the key
advantage here.
- Alex
More information about the Digitalmars-d
mailing list