Article View: comp.std.c++
Article #3378Re: Are all Windows programs ill-formed?
From: Claus A. Faerber
Date: Tue, 20 Feb 1996 18:39
Date: Tue, 20 Feb 1996 18:39
49 lines
2912 bytes
2912 bytes
Claus A. Faerber <claus@faerber.muc.de> (07 Feb 96):
> 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().
^^^ should be: WinMain()
But at all, there's no problem with Windows programs:
* If you're writing Win32 console apps or using special
libraries like EasyWin or QuickWin (which allow normal text
in/out operations in the Windows GUI), you will have a
standard main()
* If you're programming native Win16/32 GUI apps, you're
using an extended/modified C/C++-standard (unhosted env.),
as you don't have stdin/out/error and hundreds(thousands?)
of functions invading your namespace and: no main(), but Win/
LibMain.
Claus
------------------------------------------------------------------------
Claus Andre Faerber - claus@faerber.muc.de - http://www.muc.de/~cfaerber
------------------------------------------------------------------------
---
[ To submit articles: Try just posting with your newsreader. If that fails,
use mailto:std-c++@ncar.ucar.edu
FAQ: http://reality.sgi.com/employees/austern_mti/std-c++/faq.html
Policy: http://reality.sgi.com/employees/austern_mti/std-c++/policy.html
Comments? mailto:std.c++-request@ncar.ucar.edu
]
Technical Details
Message-ID:
<631ZyM9ocDB@faerber.muc.de>Path:
arc1-ca.pugleaf.net!chronicle.mti.sgi.com!austernShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!chronicle.mti.sgi.com!austern From: claus@faerber.muc.de (Claus A. Faerber) Newsgroups: comp.std.c++ Subject: Re: Are all Windows programs ill-formed? Date: 20 Feb 1996 10:39:57 PST Organization: - Approved: austern@isolde.mti.sgi.com Message-ID: <631ZyM9ocDB@faerber.muc.de> NNTP-Posting-Host: isolde.mti.sgi.com X-Original-Date: Sat, 17 Feb 1996 01:00:00 +0100 In-Reply-To: <AE5J83na99@qsar.chem.msu.su> X-Mailer: CrossPoint v3.1 R/B17071 X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBVAwUBMSoViEy4NqrwXLNJAQE43gIAoULqWzlVoYiFRkdJHxiL5Y8nw0YgaOcu FuKO+sRLzq0WwLf76uE5JCjIJCQWBbAZQcAd9uoMlUgNb2OaBnNe1Q== =qJ+C Originator: austern@isolde.mti.sgi.com