dlang / project-ideas

Collection of impactful projects in the D ecosystem
36 stars 12 forks source link

Implement C compatibility mode for DMD's header generator #85

Closed MoonlightSentinel closed 2 years ago

MoonlightSentinel commented 3 years ago

Replacement of the previous issue which proposed C/C++ header generation in general.


Description

DMD's integrated header generator (available via -HC ) emits a C++ header that contains bindings for all extern (C[++]) symbols in the compiled code. The generated header uses C++ features and hence won't be usable for C code that calls into D code.

What are rough milestones of this project?

The goal of this project is a C compatibility mode for dtoh that can be enabled from the command line. The header generator should then be restricted to C features and try to use suitable replacements for C++ constructs.

How does this project help the D community?

Easy access to D code from C.

MoonlightSentinel commented 3 years ago

This project should probably be delayed until dtoh is finished / stable.

mdparker commented 2 years ago

This was already implemented, wasn't it?

Wiguwbe commented 1 year ago

Hi, I recently took an interesting in such a feature, which is most useful when porting (bit by bit) existing C codebases to D.

This was already implemented, wasn't it?

The feature that was implemented, as @MoonlightSentinel said, was the generation for C++ header files.

This was also mentioned on #4.

As of 2.105.0, I don't think the generation of C (no C++) header files is there.

I'd ask for any information regarding developments on this matter and, if possible, to reopen this issue.