Discussion:
Winmain
(too old to reply)
b***@coolfone.comze.com
2012-06-19 17:12:31 UTC
Permalink
Can someone help me understand why the entry point of Windows programs is Winmain instead of main?
Barry Schwarz
2012-06-20 23:49:27 UTC
Permalink
Post by b***@coolfone.comze.com
Can someone help me understand why the entry point of Windows programs is Winmain instead of main?
Because that is what the people who wrote the VC compiler decided to
do.
--
Remove del for email
Faisal
2012-07-05 10:02:35 UTC
Permalink
Post by b***@coolfone.comze.com
Can someone help me understand why the entry point of Windows programs is Winmain instead of main?
excerpts from Raymond Chen's blog http://blogs.msdn.com/b/oldnewthing/archive/2007/12/03/6644060.aspx

Why wasn't the application entry point called main? Well, for one
thing, the name main was already taken, and Windows didn't have the
authority to reserve an alternate definition. There was no C language
standardization committee back then; C was what Dennis said it was,
and it was hardly guaranteed that Dennis would take any special steps
to preserve Windows source code compatibility in any future version of
the C language. Since K&R didn't specify that implementations could
extend the acceptable forms of the main function, it was entirely
possible that there was a legal C compiler that rejected programs that
declared main incorrectly. The current C language standard explicitly
permits implementation-specific alternate definitions for main, but
requiring all compilers to support this new Windows-specific version
in order to compile Windows programs would gratuitously restrict the
set of compilers you could use for writing Windows programs.

Loading...