HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
atilaneves
dpp
D2018–2021
atilaneves / dpp

dpp

Directly include C headers in D source code

9Distinct people
13Mentions
0Explicit recommenders
245GitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

Directly include C headers in D source code

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:03:16 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 year13 dated mentions

Observed mentions: 2018-06-20 19:51:31 UTC to 2021-03-24 17:11:38 UTC.

02462018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments20182019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 6 mentions; 0 submissions, 6 comments20192020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments2021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 3 mentions; 1 submissions, 2 comments2021

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
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC303
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC606
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC101
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC312

What Hacker News says

13 sources
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
A couple of points to make before I give my answer. You want to check out the Mir project linked in the other comment. It's a well-designed library (though maybe lacking documentation). The other thing is that you can #include C headers directly in a D file using https://github.com/atilaneves/dpp so you can always costlessly add a C library to your project. For optimization, I was referring to calling into the R API, which exposes the optimization routines in base R (Nelder-Mead, BFGS, Conjugate Gradient, and simple bounds constrainted BFGS). In terms of what it can handle, I guess that's entirely up to what R can handle. Here's the project page, but it looks like I haven't committed to that repo in three years: https://bitbucket.org/bachmeil/dmdoptim/src/master/ If you do try it and have problems with anything, please create an issue so
Read the rest
I can fix it or add proper documentation. I've also used this binding of the nlopt library: http://code.dlang.org/packages/libnlopt For linear algebra, I built a wrapper on top of the Gretl library http://gretl.sourceforge.net/ There were two reasons for that. First, it offered a really simple LAPACK interface when I was starting out with D, and second, it offers a lot more than just linear algebra. Is this something I'd recommend to others? I don't know. I built my infrastructure over a period of several years while waiting for my son at his many practices and activities. I also optimize for programmer convenience rather than performance at all costs. The time it takes to write correct, performant code is far more valuable than having code that runs 15% faster. This has a lot of potential, but ultimately I'm paid to do other things, meaning those things become the priority...
In Specification for the D Programming Language
D can also use C and C++ libraries (including templates), and with gcc and llvm it covers pretty much all the same architectures/platforms as nim. > with C++ the things are not so simple, because of the non standard ABI, across different compilers. With templates the things are becoming even more complicated. For now the easiest and the most reliable way to use C++ libraries from another language is to compile it to C++ This turns out not to be true. The only way to parse C++ is to use a C++ compiler; there is no negotiability there. However you can, as calypso[1] and dpp[2] (latter is not ready for primetime yet) do, use the c++ compiler to parse the c++ and then emit bindings in another language. As for ABI, there are really only two ABIs: msvc (which microsoft uses), and itanium (which everyone else uses). And D already implements
Read the rest
In My Vision of D’s Future
> 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

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.