Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!think!husc6!cmcl2!philabs!micomvax!musocs!mcgill-vision!mouse From: mouse@mcgill-vision.UUCP (der Mouse) Newsgroups: net.unix-wizards Subject: Re: linking C and Fortran Message-ID: <481@mcgill-vision.UUCP> Date: Wed, 13-Aug-86 22:38:46 EDT Article-I.D.: mcgill-v.481 Posted: Wed Aug 13 22:38:46 1986 Date-Received: Tue, 19-Aug-86 22:16:56 EDT References: <2668@brl-smoke.ARPA> Organization: McGill University, Montreal Lines: 32 Summary: C foo -> _foo, f77 foo -> _foo_ In article <2668@brl-smoke.ARPA>, moss@BRL.ARPA (Gary S. Moss (SLCBR-VLD-V)) writes: > CC prepends an underscore to the function name, and F77 appends > an underscore. [Explanation, basically that f77 _forsub <-> C forsub_] Well, I don't know what system you're on, but on all UNIX f77s I know of, f77 appends an underscore and hands the result to the C compiler, at least conceptually. The result is that C ultimately prepends an underscore and f77 *both* appends *and* prepends underscores. The net result is that what f77 knows as "forsub" is what C knows as "forsub_". > Be sure to define/invoke the function from C with pointers (call by > reference) exclusively. Good point. Also make sure the pointers point to something! Probably the commonest problem I see with pointers here is something *ptr; routine(ptr); because they've been told that "routine" takes a "pointer to something" as its argument. They never notice that this pointer has to point to a "something". -- der Mouse USA: {ihnp4,decvax,akgua,utzoo,etc}!utcsri!mcgill-vision!mouse think!mosart!mcgill-vision!mouse Europe: mcvax!decvax!utcsri!mcgill-vision!mouse ARPAnet: utcsri!mcgill-vision!mouse@uw-beaver.arpa "Come with me a few minutes, mortal, and we shall talk." - Thanatos (Piers Anthony's Bearing an Hourglass)