Hi, I'm fairly new to D and I'm writing a Space Invaders clone to get myself
acquainted with the language.

I'm having trouble passing D strings (char[]) to SDL, in particular
SDL_LoadBMP(), I keep receiving a segfault.

Heres the code:

void setImg(string path) {
    // concat null terminating char to string and cast to c type string when
    // passing to SDL_LoadBMP()
    path ~= "\0";
    image = SDL_LoadBMP( cast(char*)path );
}

and the value of path is "./resources/cannon.bmp"

I'm using SDL 1.2.14 and DMD 1.067 on Ubuntu 10.10

If someone could tell me what I'm doing wrong it would be greatly appreciated.

Reply via email to