Error when using `import`.

Liam McGillivray yoshi.pit.link.mario at gmail.com
Wed Feb 28 07:56:16 UTC 2024


There's something very strange going on when using Raylib-D.

I tried using the raylib function `LoadTexture` like this:
```
tileSprites[i] = LoadTexture("../sprites/" ~ spriteName);
```

I got the following error:
```
Error: function `raylib.LoadTexture(const(char)* fileName)` is 
not callable using argument types `(string)`
```

So it's not allowing me to use a D string, but wants me to use 
(what I believe to be) the archaic C-style string. Here is how 
this function, as well as `DrawText` is declared in the Raylib-D 
bindings:
```
void DrawText(const(char)* text, int posX, int posY, int 
fontSize, Color color); // Draw text (using default font)
Texture2D LoadTexture(const(char)* fileName); // Load texture 
from file into GPU memory (VRAM)
```

The weird thing is that both of these functions are declared only 
once and with these C-style strings as arguments, yet I have 
already successfully called `DrawText` using a D string, yet 
`Texture2D` results in an error.

```
DrawText("Open Emblem", 180, 300, 64, Colors.RAYWHITE);
```

So why is it that one of these functions, but not the other is 
allowing D strings in place of C-style strings?


More information about the Digitalmars-d-learn mailing list