Re: Help passing D strings to C libs

2011-03-14 Thread Daniel Green
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.

Re: Help passing D strings to C libs

2011-03-14 Thread Jonathan M Davis
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 program

Re: Help passing D strings to C libs

2011-03-14 Thread Gene P. Cross
-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

Re: Help passing D strings to C libs

2011-03-14 Thread Gene P. Cross
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

Re: Help passing D strings to C libs

2011-03-14 Thread Daniel Green
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

Re: Help passing D strings to C libs

2011-03-14 Thread Daniel Green
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

Re: Help passing D strings to C libs

2011-03-14 Thread Jonathan M Davis
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

Re: Help passing D strings to C libs

2011-03-14 Thread Gene P. Cross
Thanks for your help, and from here on in I'll be sure to initialise first thing. I'll look into GDB, thanks again.

Re: Help passing D strings to C libs

2011-03-14 Thread spir
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

Re: Semi-const methods?

2011-03-14 Thread Mafi
Am 13.03.2011 23:27, schrieb Magnus Lie Hetland: I have a data structure that's generally static (const, or even immutable), but it has some utility storage, which caches certain results during use. This caching etc. doesn't really affect the semantics of the main object, and are reset between

Re: Read file/stream

2011-03-14 Thread Regan Heath
On Fri, 11 Mar 2011 22:39:43 -, Stewart Gordon smjg_1...@yahoo.com wrote: On 11/03/2011 21:51, Steven Schveighoffer wrote: snip Presumably there's a reason that it's been provided for uint but not ushort or ulong I think things in std.intrinsic are functions that tie directly to

Re: Semi-const methods?

2011-03-14 Thread Magnus Lie Hetland
On 2011-03-14 00:17:18 +0100, Jonathan M Davis said: So, if you don't actually manage to _really_ be logically const, or if you do this with an immutable object (which would likely result in a segfault), you _are_ going to have incorrect code. On the whole, I'd advise just not using const when

Re: Semi-const methods?

2011-03-14 Thread Magnus Lie Hetland
On 2011-03-14 11:51:09 +0100, Mafi said: I found away which doesn't use casts or bugs. Just use delegates/closures. Nice :D -- Magnus Lie Hetland http://hetland.org

Iterating over an enum associative array

2011-03-14 Thread Nebster
Hey, I'm having some problems iterating over an enumerated associative array. It comes up with this error at compile time: Internal error: e2ir.c 4835 I cut the code down to this: import std.stdio; enum int[string] assoc = [;: 0, =: 1, +: 2, -: 2, *: 3, /: 3]; void main() {

Re: Iterating over an enum associative array

2011-03-14 Thread spir
On 03/14/2011 12:21 PM, Nebster wrote: Hey, I'm having some problems iterating over an enumerated associative array. It comes up with this error at compile time: Internal error: e2ir.c 4835 I cut the code down to this: import std.stdio; enum int[string] assoc = [;: 0, =: 1, +: 2, -: 2,

Re: Read file/stream

2011-03-14 Thread Steven Schveighoffer
On Fri, 11 Mar 2011 17:39:43 -0500, Stewart Gordon smjg_1...@yahoo.com wrote: On 11/03/2011 21:51, Steven Schveighoffer wrote: snip Presumably there's a reason that it's been provided for uint but not ushort or ulong I think things in std.intrinsic are functions that tie directly to

Re: I seem to be able to crash writefln

2011-03-14 Thread Steven Schveighoffer
On Fri, 11 Mar 2011 18:57:32 -0500, Spacen Jasset spacenjas...@yahoo.co.uk wrote: On 10/03/2011 12:18, Steven Schveighoffer wrote: On Wed, 09 Mar 2011 18:19:55 -0500, Joel Christensen joel...@gmail.com wrote: This is on Windows 7. Using a def file to stop the terminal window coming up.

Re: Iterating over an enum associative array

2011-03-14 Thread Peter Lundgren
== Quote from Nebster (evil.nebs...@gmail.com)'s article Hey, I'm having some problems iterating over an enumerated associative array. It comes up with this error at compile time: Internal error: e2ir.c 4835 I cut the code down to this: import std.stdio; enum int[string] assoc =

Re: Iterating over an enum associative array

2011-03-14 Thread zirneklis
On 14/03/2011 14:38, Peter Lundgren wrote: == Quote from Nebster (evil.nebs...@gmail.com)'s article Hey, I'm having some problems iterating over an enumerated associative array. It comes up with this error at compile time: Internal error: e2ir.c 4835 I cut the code down to this: import

Re: Iterating over an enum associative array

2011-03-14 Thread bearophile
I am back. Nebster: I'm having some problems iterating over an enumerated associative array. It comes up with this error at compile time: Internal error: e2ir.c 4835 Added: http://d.puremagic.com/issues/show_bug.cgi?id=5734 Bye, bearophile

Re: Help passing D strings to C libs

2011-03-14 Thread Trass3r
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 =

Re: Help passing D strings to C libs

2011-03-14 Thread Jonathan M Davis
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 type string