Translating C headers to D: How do I compile it?

Kirill kirill.saidov at mail.com
Sun Jun 28 04:59:12 UTC 2020


Hello. I am learning how to translate C headers to D. But how do 
I compile it? I am stuck with this.

I have 4 files in the same directory: main.d, something.d, 
some.h, some.c

some.h:
//header guards
int add(int a, int b);

some.c:
#include "some.h"
int add(int a, int b) { return a+b; }

something.d:
module something;
int add(int a, int b);

main.d:
import std.stdio: writeln;
import something;

void main() { writeln("5+7=", add(5, 7); }

How do I compile this correctly?

Thank you for your time.




More information about the Digitalmars-d-learn mailing list