On Tuesday, 6 February 2018 at 21:44:16 UTC, Ralph Doncaster
Is there an automatic way to make D wrappers for all the C
Yeah, I hear the dstep https://github.com/jacob-carlborg/dstep
works well, though I haven't personally used it - I just bring
in C functions by hand and that's fairly easy (certainly a lot
easier than actually porting the whole thing!) and a one time
thing, then it can keep up with impl updates with upstream easily
- the interface rarely changes, so you just update it like
One reason I considered porting was to see if dmd outputs
better code than gcc.
If you want D to outperform C, it usually means doing
architecture changes, and mature C libraries are usually already
pretty heavily optimized and hard to beat. D and C have about the
same performance potential; when fully optimized by hand and by
machine, both will top out about the same.
D's big advantage over C is that is is easier to realize that
potential; it takes less programmer effort to write the faster
code in the first place. But again, if the C library already has
the work done to it, D is unlikely to actually beat it,
especially with a direct port where it is likely to generate
basically the same machine code (or worse - dmd's optimizer is
generally worse than gcc's, and gdc's optimizer is exactly the
same as gcc's).