Alf P. Steinbach wrote:
:: * George2:
:::
::: For entry point of a console application,
:::
:::
http://msdn2.microsoft.com/en-us/library/f9t8842e(VS.71).aspx
::
:: Well, judging from what you write below you have misunderstanding:
:: a program's /entry point/ is not the C or C++ function "main",
:: it's code that in turn, after doing various things, calls "main".
:: Consider that e.g. Pascal does not have a "main" function. How to
:: use the Microsoft linker to specify an entry point is largely
:: off-topic in this group.
::
::
::: My understanding is it is important that the name of the function
::: main exists, and it does not matter the prototype of main
::: function, for example,
:::
::: we can define main as int main () or int main (int argc, char**
::: argv).
:::
::: Is that understanding correct?
::
:: The C++ standard requires a "main" startup function with "int"
:: result type.
::
:: The two signatures you show above must be supported.
::
:: With Microsoft tools you may indeed have to use the linker option
:: you referred to above, in order to correctly have the standard
:: "main"
:: startup function called by the entry point code. Specifying the
:: entry point in order to have "main" called is not, however,
:: necessary with
:: e.g. the GNU toolchain. It is unfortunate that a major compiler
:: vendor still as of late 2007 hasn't managed to correctly implement
:: a feature
:: from 1972 (going back to original C) so that you have to use linker
:: options, but then, that compiler defaults to non-standard behavior
:: also
:: in many other respects: you have to use a load of options to get
:: standard-conforming mode (exceptions, RTTI, for-loop scope,
:: wchar_t).
That's just not the case. If you have a main() function in your code,
it will be called (eventually).