Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site ucbvax.BERKELEY.EDU Path: utzoo!decvax!ittatc!dcdwest!sdcsvax!ucbvax!edison.UUCP!jso From: jso@edison.UUCP (John Owens) Newsgroups: mod.computers.vax Subject: Re: main() and entry points in C Message-ID: <8607071658.AA15798@edison.UUCP> Date: Mon, 7-Jul-86 12:58:16 EDT Article-I.D.: edison.8607071658.AA15798 Posted: Mon Jul 7 12:58:16 1986 Date-Received: Tue, 8-Jul-86 19:03:57 EDT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The ARPA Internet Lines: 41 Approved: info-vax@sri-kl.arpa I agree. Certainly there are many UNIX programs that take advantage of specific non-portable features! I wish that more people would use varargs, but old habits die hard. varargs being a fairly recent innovation, many people won't use it just because they're likely to find more UNIX implementations that'll work the old way than those with varargs, since everyone wants to stay compatible with existing programs! I finally went and read the start() routine, and was surprised to find that it was written partially in C, with a few "asm" directives. Many other UNIX implementations, such as the PDP-11 ones, have this written in assembler, with no public symbol for the first location. (The name _start comes from the fact that the C compiler prepends an underscore to any external symbol.) WRT mixing languages, I've found that just as cc will run as on any assembler files, then invoke the loader appropriately, f77 will invoke the c compiler on any .c files and the assembler on any .s files, etc. The (admittedly ad-hoc) solution has usually been to have the interface to your "new" langauge handle the linking with C modules, and any others you know about. Even without this, you can always do something like: cc a.c b.c c.c f77 d.f e.f mod2 f.m g.m -- and then, if your main program is C, with Fortran and Modula-2 routines -- cc a.o b.o c.o d.o e.o f.o g.o -- or if it's Fortran with C and Modula-2 routines -- f77 a.o b.o c.o d.o e.o f.o g.o -- etc, since any interface should just pass .o files on to ld -- One of the things I actually liked about VMS (really! it does have a few redeeming qualities) was that all the langauge interfaces were extremely standardized, to the point that the main rtl was common to all languages. Of course it didn't have to be so cumbersome an interface.... In hope of universitality- -John (edison!jso%virginia@CSNET-RELAY.ARPA)