On Wednesday, 6 June 2012 at 02:52:39 UTC, BLM768 wrote:
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().

You don't have to use WinMain as the entry point for Win32 programs if that's the problem. If you need the instance handle, you can get it from GetModuleHandle(null).

Reply via email to