HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
jacob-carlborg
dstep
C2013–2024
jacob-carlborg / dstep

dstep

A tool for converting C and Objective-C headers to D modules

9Distinct people
11Mentions
0Explicit recommenders
217GitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

A tool for converting C and Objective-C headers to D modules

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

Mentioned in the same Hacker News threads. That is not proof they are substitutes.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 3:56:07 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year11 dated mentions

Observed mentions: 2013-08-22 08:48:06 UTC to 2024-07-30 10:44:18 UTC.

012342013-01-01 00:00:00 UTC to 2014-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments20132014-01-01 00:00:00 UTC to 2015-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2015-01-01 00:00:00 UTC to 2016-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2016-01-01 00:00:00 UTC to 2017-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2017-01-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments20182019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 3 mentions; 1 submissions, 2 comments2020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 4 mentions; 0 submissions, 4 comments2022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2024

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20132013-01-01 00:00:00 UTC2014-01-01 00:00:00 UTC101
20142014-01-01 00:00:00 UTC2015-01-01 00:00:00 UTC000
20152015-01-01 00:00:00 UTC2016-01-01 00:00:00 UTC101
20162016-01-01 00:00:00 UTC2017-01-01 00:00:00 UTC000
20172017-01-01 00:00:00 UTC2018-01-01 00:00:00 UTC000
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC101
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC312
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC000
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC404
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC000
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC000
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC101

What Hacker News says

11 sources
> as someone who loves C and dislikes almost every implementation of C interop and FFI I’ve used in other languages (Rust is a notable exception to this), Have you tried D? It can import C files as if they were D modules: https://dlang.org/spec/importc.html Basically, if there's a `hello.c` file next to your D file, you simply import it with: import hello And use the functions it provides. You can also import only a subset of it, of course: import hello: square; Or rename the import: import hi = hello; The C stdlib is exposed by D's stdlib as if it were a D library: https://dlang.org/phobos/core_stdc_assert_.html C libraries (header files) can be compiled to D and then used as D modules as well, see https://github.com/jacob-carlborg/dstep Is that as good as Rust?
In C Macro Reflection in Zig
Out of curiosity, have you written apps in both languages? I have written small applications in both. To be transparent: my total dev hours in D are probably somewhere around ~100, and in Zig about ~30. So I am more familiar with D than Zig, though competent enough with both to have written a few small real-world programs. > Its interoperability with C at the source and object level is first-class D has direct interop with both C, and C++. Also, it's recently gained it's own C compiler, and can natively compile C code so that they are D objects, not just external definitions. - https://dlang.org/spec/interfaceToC.html - https://dlang.org/spec/cpp_interface.html It can even directly interop with C++ classes: - https://dlang.org/spec/cpp_interface.html#using_cpp_classes_... > the syntax was very easy for me to pick up as someone famili
Read the rest
ar with C/C++ D is closer to C/C++ than Zig IMO. One of it's design goals is actually: "10. Where D code looks the same as C code, have it either behave the same or issue an error." And: "The general look and feel of C/C++ is adopted. It uses the same algebraic syntax, most of the same expression and statement forms, and the general layout." See: https://dlang.org/overview.html#goals I found Zig to be much less syntactically similar to C/C++ than D. Zig felt more like a mix of Rust/Go. > the features it adds on top of C (e.g. slices, compile time execution) D also has slices and (outside of Lisp) was the first programming language I believe to introduce CTFE and CTFE-based metaprogramming. C++'s implementation as I understand it is essentially lifted from D. - https://dlang.org/articles/d-array-article.html#introducing-... - https://tour.dlang.org/tour/en/gems/compile-time-function-ev... > its translate-c utility works amazingly well at transpiling C code to Zig As stated above, not required due to ImportC, but there are several tools to automatically generate "extern" bindings to C/ObjectiveC/C++. You use these if you're linking with an external out-of-tree library, or a C++ library. - C, Limited C++ = https://dlang.org/blog/2019/04/08/project-highlight-dpp - C, Extensive C++ = https://github.com/Superbelko/ohmygentool - C, Objective-C = https://github.com/jacob-carlborg/dstep > its test blocks make unit testing trivial to integrate. Again, D also has this: - https://tour.dlang.org/tour/en/gems/unittesting ============= Not trying to start a pissing match, because I actually think that Zig has a lot to offer as well -- but for these particular list of things, there's no clear winner here.
In Maintain It with Zig
They've been putting a lot of work into an experimental automatic C++ header generator lately. https://dlang.org/changelog/2.096.0.html#dtoh-improvements Each changelog for the last good handful has seen a lot of work in this area. I recently had to write and learn a bit of C++ for the first time, and tried at all costs to avoid it (FFI/interop from Rust or D). I wound up biting the bullet and writing C++ but I learned a lot about FFI in general and how interop works, plus your options available in both languages. D has this new experimental C++ header generator (which is exciting), plus D has always had: extern (C++) Which is capable of directly linking + invoking most C++ things (except constructors/destructors, it can't handle those, you need a function which calls the constructor from within C++) just given a type definition. Then
Read the rest
you have "d++", which lets you "#include" C/C++ headers. Under the hood tries to run an automatic syntax conversion. It can't handle <std> but for simple code it works and can spit out the equivalent D. https://github.com/atilaneves/dpp Also you've got "dstep", which is "A tool for converting C and Objective-C headers to D modules" https://github.com/jacob-carlborg/dstep And finally you have the somewhat abandoned (but as far as I know mostly functional) Calypso, which is a fork of the LLVM-based D compiler that supports direct interop with C++. It's a pain to build though, haven't gotten around to trying to build it, but it does look wicked cool: https://github.com/Syniurge/Calypso pragma (cppmap, "cppheader.h"); // tells Clang to parse cppheader.h but do not import anything import (C++) NamespaceA.Class1; // imports NamespaceA::Class1 import (C++) NamespaceA; // imports the full namespace import (C++) *; // imports the entire translation unit So I am hopeful about the future of the relationship between C++ and D. I would really have loved to have not written that C++ lol.
In D 2.096 and other news
> Dmd's backend was ported by hand. Not quite, the c++ source was massaged to be free of weird corner cases of the grammar and preprocessor (e.g. enforcing no spaces between '#' and the preprocessor keyword) and then a tool called magicport was used to convert the frontend in one shot. The backend was mostly converted by "hand" (i.e. grep after some more massaging). There are several tools to translate headers though dstep[1] and dpp[2] come to mind [1]: https://github.com/jacob-carlborg/dstep [2]: https://github.com/atilaneves/dpp
In D as a C Replacement
I can. I've written D interfaces to vendor-supplied C and C++ SDKs and for an open source C library (libusb). We're using this at work. For C, it's relatively easy and mechanical to translate by hand but https://github.com/jacob-carlborg/dstep makes starting trivial. For C++, I had two cases- one was easy as that vendor provided a C handle and function call syntax while the other required doing a C shim (facade) to wrap up the object. I didn't find SWIG to be useful but did examine its output to get ideas. The built-in unit testing in D is very handy.
In Moving forward with work on the D language and foundation

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.