Regan Heath (Mai 23, 2004).
I have managed to get MSDEV to compile and debug my D programs (thanks to
Arcane Jill for the idea)
Here is what I did:
1. create an MSDEV "Utility" project - these are like normal projects but
they do not do the link step.
2. add your .d source files to this project. (all of them).
3. edit project settings, expand list on left, for each source file define
the following "Custom Build" settings:
D:\D\dmd\bin\dmd.exe -c "$(InputPath)" -g -profile -debug -c -od"$(IntDir)"
[as this is the same for all source files, it'd be great if I could define
it for all somewhere instead of having to define it for each and every
4. edit project settings, click project name at top of tree on left, in
the post-build section add the command
d:\D\dmd\bin\dmd.exe -g "$(IntDir)\*.obj" -of"$(OutDir)\main.exe"
and that's it. Hit compile and it should create a Debug/Release dir with
the .obj and .exe file in it. Put a breakpoint in and press Run and you're
debugging (assuming you're in debug mode)
Lionello Lunesu (January 11, 2005).
One thing to note is that VC's debugger doesn't always break at exceptions.
For example, it won't break if there's a exception handler in the
application, which in D there always is (the handler that prints the
exception on the console).
So for VC to break, you'll have to mark the exception as "break always" in
the menu (only available while debugging): Debug -> Exceptions...
There, enter the exception number (as dumped in VCs output window), enter
some human readable name and select as action "Stop always". Then click
void main( char args )
int *p = null;
*p = 0;
Compile it with -g AND -debug. Run it from VC (F5, debug). In the console
Error: Access Violation
Press any key to continue
And in the output pane:
Loaded 'ntdll.dll', no matching symbolic information found.
Loaded 'C:\WINDOWS\system32\kernel32.dll', no matching symbolic information
Loaded 'C:\WINDOWS\system32\user32.dll', no matching symbolic information
Loaded 'C:\WINDOWS\system32\gdi32.dll', no matching symbolic information
First-chance exception in fart.exe: 0xC0000005: Access Violation.
The thread 0x120 has exited with code 1 (0x1).
The program 'C:\UTIL\d\debug\fart.exe' has exited with code 1 (0x1).
But notice that VC did not break!
Now press F11(step into) and go to the menu Debug -> Exceptions. The
exception 0xC0000005 exists so we don't add it but we select it. You'll see
that the (default) action is "stop if not handled". Change this to "Stop
always" and click "Change". Now continue running the program, F5. VC will