digitalmars.D - Finishing off C++ Header generation, a request for help
- Nicholas Wilson (28/28) Oct 12 2023 I recently attempted to use the `-HC` generated dmd/frontend.h to
- kinke (4/4) Oct 12 2023 I think one big problem is that a truly usable frontend.h would
- Nicholas Wilson (3/7) Oct 12 2023 Not really, you'd generate it "on demand" with the D compiler you
- Iain Buclaw (5/12) Oct 13 2023 With all its bugs in generating C++ headers that don't exist in
I recently attempted to use the `-HC` generated dmd/frontend.h to build LDC and discovered it doesn't work: So far I have fixed: * redefinition of `size_t` * appending of _ to C keywords (to the disgruntlement of Iain), so that the tokens enum work with clang Still to do: * generate `#include <stdarg.h>` when `va_list` is used * general issues of declaration order and forward declarations: some resolution is too eager resulting in subclasses being emitted before their base classes. other is not eager enough resulting in typedefs of templates not forward declaring their arguments ending up with `typedef Array<BaseClass* > BaseClasses not referring to a valid (i.e. prior) definition of `struct BaseClass`. I'm currently in the weeds of resolving the order of declaration issues, but it is rather annoying and tedious, given DMD does not build on macOS. But before I lose the rest of my marbles trying to do that I thought I put out an invitation/request for help for anyone interested in learning a bit of DMD, given the success I had last time. Thanks already to Rikki for the header generation command! I can provide an overview of what needs to be done along with a guided tour of the relevant bits of DMD and pull request reviews and so on. Hit me up on the Discord if you are interested. Thanks in advance, Nic
Oct 12 2023
I think one big problem is that a truly usable frontend.h would have to accomodate for all platforms. So all `version(XY)` stuff (Windows, Posix, …), 32/64-bit differences etc. would have to be accounted for.
Oct 12 2023
On Thursday, 12 October 2023 at 14:34:01 UTC, kinke wrote:I think one big problem is that a truly usable frontend.h would have to accomodate for all platforms. So all `version(XY)` stuff (Windows, Posix, …), 32/64-bit differences etc. would have to be accounted for.Not really, you'd generate it "on demand" with the D compiler you are using to build LDC/GDC.
Oct 12 2023
On Thursday, 12 October 2023 at 22:56:20 UTC, Nicholas Wilson wrote:On Thursday, 12 October 2023 at 14:34:01 UTC, kinke wrote:With all its bugs in generating C++ headers that don't exist in the latest version you're trying to compile. Reducing what gets exposed to C++ interface would get you further.I think one big problem is that a truly usable frontend.h would have to accomodate for all platforms. So all `version(XY)` stuff (Windows, Posix, …), 32/64-bit differences etc. would have to be accounted for.Not really, you'd generate it "on demand" with the D compiler you are using to build LDC/GDC.
Oct 13 2023