make D windows-aware

Chris Miller chris at dprogramming.com
Wed Mar 22 13:52:00 PST 2006


On Wed, 22 Mar 2006 14:30:29 -0500, Jarrett Billingsley  
<kb3ctd2 at yahoo.com> wrote:

> DMD is Windows-aware in the sense that if you have a WinMain(), it emits  
> a
> reference to acrtused or whatever, but what I mean is make it so we don't
> have to manually put all the D init / deinit code in the WinMain().  I  
> mean,
> when we define main() for a console program, it automatically calls  
> dmain()
> which calls main().  Why not make it so when we define WinMain(), it
> automatically calls DWinMain() before our WinMain() or something?
>
> I can only see this as an advantage, as well, as then any fancy things
> Walter puts into dmain (like exception stack traces and just exception
> handling in general) will be put into DWinMain as well, instead of the
> "WinMain" living in (of all places) the docs and having to be copied into
> any Windows programs.
>

I just always use a D main and tell the linker what type of exe to make  
(pass -L/exet:nt/su:windows:4.0 or similar to DMD). I think this is how it  
always should have been. This lets you use D main char[][]args and/or  
WinMain args via GetCommandLine().



More information about the Digitalmars-d mailing list