Calling main() from WinMain()

BLM768 blm768 at gmail.com
Tue Jun 5 19:52:38 PDT 2012


I've researched this some more, and it appears that WinMain() 
actually doesn't do any runtime initialization. That means I 
should be able to just call the C main from WinMain() and let it 
initialize the runtime and call _Dmain(). The main problem I have 
now is that as soon as I put main() in, DMD uses it as the entry 
point instead of WinMain() despite passing the 
-L/exet:nt/su:windows:4.0 argument. The reason that I wanted to 
call main() from WinMain() is that I'm hoping to write some 
cross-platform GUI code and I thought I needed WinMain() to get 
the instance handle, but I wanted it to be transparent on other 
platforms. I've found another method that might work, though, so 
I'll try that instead of WinMain().



More information about the Digitalmars-d-learn mailing list