On Monday, March 14, 2011 10:54:57 Trass3r wrote:
> > 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
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 =
On 03/14/2011 07:55 AM, Gene P. Cross wrote:
-Daniel
I tried what you said:
char* ptr = toStringz(path);
SDL_LoadBMP(ptr);
and made a check to see if the pointer is null, which it isn't, but I'm unable
to
inspect is value, I haven't a debugger at the moment, could you recommend one ?
I also m
Thanks for your help, and from here on in I'll be sure to initialise first
thing.
I'll look into GDB, thanks again.
On Monday 14 March 2011 00:07:05 Gene P. Cross wrote:
> I found the problem.
>
> I've set up my 'main' file to act on various game states and because my
> load state is physically below the running state (where the problems were
> occuring), even though they were getting called first, the program
On 3/14/2011 3:07 AM, Gene P. Cross wrote:
I found the problem.
I've set up my 'main' file to act on various game states and because my load
state
is physically below the running state (where the problems were occuring), even
though they were getting called first, the program starts in the load
On 3/14/2011 2:55 AM, Gene P. Cross wrote:
I haven't a debugger at the moment, could you recommend one ?
Sorry, I use GDB with GDC. I don't know about DMD, it may work with GDB
on linux. You could try installing GDC and see if the results are the
same. That may help to rule out the compiler
I found the problem.
I've set up my 'main' file to act on various game states and because my load
state
is physically below the running state (where the problems were occuring), even
though they were getting called first, the program starts in the loading state,
dmd wasn't having it. I tried movi
-Daniel
I tried what you said:
char* ptr = toStringz(path);
SDL_LoadBMP(ptr);
and made a check to see if the pointer is null, which it isn't, but I'm unable
to
inspect is value, I haven't a debugger at the moment, could you recommend one ?
I also made the string a char[] and tested to see if th
On Sunday 13 March 2011 22:38:49 Gene P. Cross wrote:
> I've amended the source to pass the strings pointer (path.ptr) after adding
> a null but the problem still persists.
>
> I lost for what it could be and I'm certain this is where the problem is,
> because if I remove the method call, the prog
On 3/14/2011 1:38 AM, Gene P. Cross wrote:
I've amended the source to pass the strings pointer (path.ptr) after adding a
null
but the problem still persists.
I lost for what it could be and I'm certain this is where the problem is,
because
if I remove the method call, the program runs fine.
I
I've amended the source to pass the strings pointer (path.ptr) after adding a
null
but the problem still persists.
I lost for what it could be and I'm certain this is where the problem is,
because
if I remove the method call, the program runs fine.
I've noticed that calling SDL_LoadBMP and pass
On Sunday 13 March 2011 21:32:49 Gene P. Cross wrote:
> 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
toStringz is in D1 but still no luck, I still get the same error
Thanks for the suggestion though
Wait, actually I'm not sure if there's toStringz for D1, it is there
for D2. Try it out, I guess.
Use toStringz from std.string, ala:
SDL_LoadBMP(toStringz(path));
Do not embed nulls before calling toStringz, so remove 'path ~= "\0";'
16 matches
Mail list logo