[TUHS] why the leading under score added to function names?

Ronald Natalie ron at ronnatalie.com
Sun Feb 26 23:28:36 AEST 2012


On Feb 25, 2012, at 5:15 PM, Random832 wrote:
>> 
> 
> This is not true in my experience. If it was ever true, it's not true
> today (with MSVC, anyway. GCC may be different, but if there is a
> 'system-provided main()' it's GCC, or cygwin or mingw, and not anything
> from microsoft, that is providing it). The procedure "provided by
> windows" (provided by MSVC, actually) that does that is in fact called
> WinMainCRTStartup.

WinMainCRTStartup isn't the replacement for main.   It's the replacement for begin or location zero back in the old days.  (Anybody remember seeing p&P6 printed by errant programs?).   There are different versions of that CRT startup (actually all compiled from the same module with ifdefs) that start:

main - for non-MFC console apps
wmain - same thing but with wchar_t arguments (SOMETHING C/C++ standards hasn't ever addressed to my satisfaction).
WinMain - MFC main function
wWinMain - Ditto, with wchar_t

Actually the bulk of the CRT involves converting between the command line argument as a string and argc/argv (something UNIX does by the OS), and some gook necessary to support C++.

The  fake UNIX environment (POSIX) (read/write/seek, etc...) actually is NOT initialized here, but when it is actually referenced.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20120226/8dc5369c/attachment.html>


More information about the TUHS mailing list