[net.lang.f77] calling _printf

tom@uwai.UUCP (10/26/84)

Does anyone out there know how to call _printf() from f77 and the hazards
involved with this?  The f77 compiler seems to both append *and* prepend
an underscore to external subroutine names, so printf becomes _printf_
rather than _printf.  This means that a -lc on the ld call won't get it
for you.  Anyone got a cure?

-- 

Tom Christiansen
University of Wisconsin
Computer Science Systems Lab 
...!{allegra,heurikon,ihnp4,seismo,uwm-evax}!uwvax!tom
tom@wisc-crys.arpa

gwyn@brl-tgr.ARPA (Doug Gwyn <gwyn>) (10/27/84)

> Does anyone out there know how to call _printf() from f77 and the hazards
> involved with this?

As has been pointed out recently, mixing Fortran and C I/O is hazardous.
The file descriptors that the Fortran run-time support has squirreled
away are not directly accessible from Fortran, and there is no promise
(for example) that LUN 6 is associated with UNIX file descriptor 1
(although it usually will be if you haven't been doing anything fancy).

For something as simple as printf(), you can probably get away with it.
You will need to write a small interface that is callable from Fortran
and that passes its parameters on to printf().  Watch out for buffering!

mather@uicsl.UUCP (10/29/84)

Has anyone ever written a program that successfully interfaces
C, Fortran, LISP, and Pascal under UN*X ??

Each calling each other.

I'll bet you could lose your mind.

Is there a COBOL compiler under 4.2?

BASIC?
					b.c.mather
					software surgeon
					uiucdcs!uicsl!mather