#include C headers in D code

Steven Schveighoffer schveiguy at yahoo.com
Tue Apr 10 13:53:34 UTC 2018


On 4/9/18 7:03 AM, Atila Neves wrote:
> Here's my blog post about my project that allows directly #including C 
> headers in D*
> 
> https://atilanevesoncode.wordpress.com/2018/04/09/include-c-headers-in-d-code/ 
> 
> 
> The summary is that, modulo bugs, things like this work:
> 
>      #include <stdio.h>
>      void main() { printf("Hello world\n".ptr); }
> 
> So far it's successfully compiled whilst #including pthread, libcurl, 
> openssl and others. The blog and the github README have more 
> information, and feel free to reply to this with questions.
> 
> dub: http://code.dlang.org/packages/dpp
> reddit: 
> https://www.reddit.com/r/programming/comments/8axj53/include_c_headers_in_d_code/ 
> 
> hacker news: It's in there somewhere, search around.
> 
> Atila
> 
> * Technically, "D + #include directives + C macros"

Awesome. Can't say I will use it, as I don't use C much, but I 
understand how difficult a task this is.

If you get to the point where you can #include <vector>, it will be 
doubly impressive!

-Steve


More information about the Digitalmars-d-announce mailing list