🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #3324

Re: Are all Windows programs ill-formed?

#3324
From: Claus A. Faerber
Date: Wed, 07 Feb 1996 20:31
31 lines
2083 bytes
David Byrden <100101.2547@compuserve.com> (02 Feb 96):

> >> It requires every program to have the main() function (which
> >> implementation is not allowed to supply) with parameters (void) or (int
> >> argc, int*argv[]). However, Windows programs have another convention:
> >> prrogram must contain the function  int WinMain
>
> I remember reading that you can write a Windows program with a main()
> function and the usual command line arguments, and then the Microsoft
> compiler will then generate WinMain somehow....but that the "operating
> system" does link to WinMain.

No, the operating system doesn't care whether there is a  
WinMain(), a main() or anything else. It just reads a  
pointer  from the exe file and calls it. This is usually the  
C/C++ statup code, which then calls WinMain() or main().
If there is a main present, the linker makes the startup  
code call it, if not the linker either sets in an own  
main(), which calls WinMain(), or another startup code,  
which calls main().

Claus

------------------------------------------------------------------------
Claus Andre Faerber - claus@faerber.muc.de - http://www.muc.de/~cfaerber
------------------------------------------------------------------------

[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy is
  summarized in http://reality.sgi.com/employees/austern_mti/std-c++/policy.html
]
Technical Details
Message-ID: <62PO12fJcDB@faerber.muc.de>
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamage

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews1.Eng.Sun.COM!taumet!clamage
From: claus@faerber.muc.de (Claus A. Faerber)
Newsgroups: comp.std.c++
Subject: Re: Are all Windows programs ill-formed?
Date: 7 Feb 1996 20:31:04 GMT
Organization: ?
Approved: clamage@eng.sun.com (comp.std.c++)
Message-ID: <62PO12fJcDB@faerber.muc.de>
NNTP-Posting-Host: taumet.eng.sun.com
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
In-Reply-To: <AE5J83na99@qsar.chem.msu.su>
X-Mailer: CrossPoint v3.1 R/B17071
X-Lines: 26
Content-Length: 1234
Originator: clamage@taumet