ImportC rocks!

Andrea Fontana nospam at example.com
Mon Mar 14 10:47:24 UTC 2022


On Saturday, 12 March 2022 at 09:55:03 UTC, Ki Rill wrote:
> 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
> ```


The big problem is that #define are missing. So a lot of const 
must be redefined or made explicit like:

ray.h:
```
#include "raylib.h"
Color RAYLIB_BLACK = BLACK;
  ```

But  it's not so comfortable to use.

I would like to mix different languages, just like kotlin+java on 
android development or like calypso did.



More information about the Digitalmars-d mailing list