On 2018-08-22 13:01, Mihails wrote:
https://gitlab.com/mihails.strasuns/dtoh
Tool to grab all `extern(C)` declarations in a D module and generate C
header file based on it. Partially addresses
https://issues.dlang.org/show_bug.cgi?id=9285 but is intended to be much
more simple (no C++, no human-readable emphasis).
Main differences from version written by Adam some years ago:
- Uses DMD frontend as a library directly
- Has tests
Former is quite intentional decision though I do expect it to be
controversial. Using json output requires parsing information that is
already present in DMD FE in a strongly typed way - and the only benefit
is that the tool becomes more decoupled from compiler. In my opinion,
this functionality _should_ be part of compiler itself, similar to .di
generation.
Sadly can't put it on code.dlang.org right now because there are no
tagged versions of http://code.dlang.org/packages/dmd to depend on, thus
have to resort to submodule.
Iain has a PR in DMD for generating C++ headers from extern(C++)
declarations [1]. Perhaps join forces on this.
[1] https://github.com/dlang/dmd/pull/8591
--
/Jacob Carlborg