Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!brutus.cs.uiuc.edu!ginosko!aplcen!uakari.primate.wisc.edu!ames!purdue!gatech!bloom-beacon!mcgill-vision!mouse From: mouse@mcgill-vision.UUCP (der Mouse) Newsgroups: comp.lang.c Subject: Re: entry at other than main (was: want to know) Message-ID: <1643@mcgill-vision.UUCP> Date: 16 Sep 89 03:35:32 GMT References: <19474@gryphon.COM> <21897@cup.portal.com> Distribution: na Organization: McGill University, Montreal Lines: 36 In article <21897@cup.portal.com>, Tim_CDC_Roberts@cup.portal.com writes: > Let me give an example of a case where "main" as main program > possibly makes an inconvenience. > Take Control Data (...please). On our systems, after compiling and > linking a set of object routines, you end out with an executable > file. This executable can then be placed into a LIBRARY with many > other executables. If all the executables have the same entry point > name (main or crt0 or _start_up or whatever), how do you designate > which executable in the current library you wish to invoke? > I'm not advocating changing C. Our scheme was developed when FORTRAN > (PROGRAM ABCD1), COBOL (ID DIVISION...PROGRAM-NAME IS ABCD2.), and > even Pascal (PROGRAM ABCD3;) were popular. But adding C to the list > does require some rethinking. main() is a specification of how the *C source code* specifies the main entry point. It does not necessarily imply that the symbol table of the output file (assuming there is such) contains anything bearing any resemblance to "main". A C compiler on your CDC system would be perfectly justified in recognizing the name "main" specially and producing, instead of a normal symbol table entry, a name derived somehow else (the name of the source file, perhaps?) and marked as "main entry point", the same as would be produced by FORTRAN or Pascal for a PROGRAM, for PL/I's PROC OPTIONS(MAIN), etc. (I don't know whether main() is required to work if called recursively or not; if so, the compiler would have to recognize the name "main" in certain other contexts as well.) All that's required is that there be no possibility of this special symbol table entry preventing the user from writing a routine which happens to have the same name as the source file (for example). Nothing insurmountable. der Mouse old: mcgill-vision!mouse new: mouse@larry.mcrcim.mcgill.edu