ImportC rocks!

Ki Rill rill.ki at yahoo.com
Sat Mar 12 09:55:03 UTC 2022


I tried using Raylib with importC, and I thought I should share 
my recent experience using it... Works like a charm! Worked from 
the first (second really) try!

What I did step by step (in case someone needs directions):

raylib.c:
```
#include "raylib.h"
```

main.d:
```
void main() {
     import raylib;

     InitWindow(640, 640, "ImportC raylib test");
     // game loop
     CloseWindow();
}
```

Compiling:
```
gcc -E raylib.c > raylib.i
dmd main.d raylib.c -L=-lraylib
./main
```

I really like the fact that dmd automatically picks up a name for 
the executable.

It was a pleasant experience using D when it actually 'just' 
works. There is still much to improve on ImportC, but I like that 
we slowly get there... when it's easily usable.








More information about the Digitalmars-d mailing list