digitalmars.D - WinMain or main
- Samuel (5/5) Sep 10 2005 Windows applications in dmd's sample directory all define a "WinMain" as...
- J Thomas (7/14) Sep 11 2005 Its been a few years since I've read Windows Internals, but if I recall
- J Thomas (3/10) Sep 11 2005 also note, its possible to create a win32 console app that creates a
- Hasan Aljudy (4/21) Sep 11 2005 I noticed glut does that.
- John Reimer (7/13) Sep 11 2005 All these questions have been asked before (several times over). You
- Bruno Medeiros (9/14) Sep 12 2005 Yes you can, you can use main() and choose whether or not the console
Windows applications in dmd's sample directory all define a "WinMain" as the entry point, but I notice that DWT's GUI samples all use the good old "main" function, and the compiled programs still start normally without displaying a console window. I'm a bit confused. Shouldn't all Win32 GUI programs provide a WinMain? Why does "main" work, too?
Sep 10 2005
Its been a few years since I've read Windows Internals, but if I recall correctly, all exes have a main(). windows GUI apps are built with a default runtime main() that calls WinMain(). therefore its possible to build a windows gui app with a main() entry point. as I said its been many years since ive researched this and vaguely remember the details, but I think its something like this.... Samuel wrote:Windows applications in dmd's sample directory all define a "WinMain" as the entry point, but I notice that DWT's GUI samples all use the good old "main" function, and the compiled programs still start normally without displaying a console window. I'm a bit confused. Shouldn't all Win32 GUI programs provide a WinMain? Why does "main" work, too?
Sep 11 2005
also note, its possible to create a win32 console app that creates a gui, which is another reason those samples may be using a main() Samuel wrote:Windows applications in dmd's sample directory all define a "WinMain" as the entry point, but I notice that DWT's GUI samples all use the good old "main" function, and the compiled programs still start normally without displaying a console window. I'm a bit confused. Shouldn't all Win32 GUI programs provide a WinMain? Why does "main" work, too?
Sep 11 2005
I noticed glut does that. This maybe OT, but can you compile code which uses main() so that it doesn't show a black console window when it runs? J Thomas wrote:also note, its possible to create a win32 console app that creates a gui, which is another reason those samples may be using a main() Samuel wrote:Windows applications in dmd's sample directory all define a "WinMain" as the entry point, but I notice that DWT's GUI samples all use the good old "main" function, and the compiled programs still start normally without displaying a console window. I'm a bit confused. Shouldn't all Win32 GUI programs provide a WinMain? Why does "main" work, too?
Sep 11 2005
Hasan Aljudy wrote:I noticed glut does that. This maybe OT, but can you compile code which uses main() so that it doesn't show a black console window when it runs? J Thomas wrote:All these questions have been asked before (several times over). You might like to searth this and the old D newsgroup for the solutions. Also have a look at the C++ newsgroup too since these questions are not D language specific ones. D wiki site is another good resource. It shows how to eliminate the black console. -JJR
Sep 11 2005
Hasan Aljudy wrote:I noticed glut does that. This maybe OT, but can you compile code which uses main() so that it doesn't show a black console window when it runs?Yes you can, you can use main() and choose whether or not the console appears, it depends only on some compiler options. I've done that (with an SDL app) in both VC++, MinGW, and DMD (ported to D). Cant explain exactly why (not that it matters much) since I don't know the internal details myself (altough I'd like to). -- Bruno Medeiros Computer Science/Engineering student
Sep 12 2005