Article View: comp.sys.sun
Article #1351FORTRAN inside C -- I/O init for UNIX
From: George A. Planansky
Date: Fri, 01 Sep 1989 17:30
Date: Fri, 01 Sep 1989 17:30
63 lines
2242 bytes
2242 bytes
I want to put a C wrapper around Fortran utilities, to make command line
parsing and so on easy. The Sun FORTRAN programmer's guide, section 11.3
(The C-FORTRAN Interface), page 186 (revision A 6 May 1988), says, with
regard to execution that starts with the C main and so does not do the
FORTRAN I/O library initializations for a FORTRAN subroutine that it
calls:
The C program should initialize I/O by inserting the
following line at the start of the program:
call f_init()
This establishes the preconnection of units 0, 5, 6.
This does not look like C code to me, or, to cc -- I nonetheless did put
the line in some plausible places, but it didn't take.
1. where and how do f_init() and f_exit() really go?
2. how do I tell cc, or f77, where to find/ resolve these objects?
3. in general, in Unix (Sun OS and 4.3BSD), how do you compile FORTRAN
subroutines, to run under a C main(argc, argv) ? The Sun manual says:
cc main.c fsub.f -lF77 -lI77 -lU77 -lc -lm
Are these libraries and that invocation standard in 4.3? I would like to
run the same stuff on our Suns (3/60's, 3/280, OS 4.01) and our Alliant
fx40 (4.3 BSD essentially).
Alliant's FORTRAN manual tells me that, to get the I/O stuff, I need to
put a FORTRAN wrapper around my C-wrapper, that is:
program fmain
call cmain
end
for:
#include <stdio.h>
cmain()
{
...
fsub_()
}
with:
subroutine fsub()
...
end
But this defeats my intention, of using C's command line arguments. How
else can I get the necessary I/O or init stuff?
Please send your enlightening replies to me, and I will summarize if there
is interest.
email to : gplan@ra.umb.edu
George Planansky
Atmosphere Environment Research
Cambridge MA
(617) 547-6207
Technical Details
Message-ID:
<1330@brazos.Rice.edu>Path:
arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!ames!ncar!husc6!rice!sun-spots-requestShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!ames!ncar!husc6!rice!sun-spots-request From: gplan@umb.umb.edu (George A. Planansky) Newsgroups: comp.sys.sun Subject: FORTRAN inside C -- I/O init for UNIX Keywords: Software Message-ID: <1330@brazos.Rice.edu> Date: 1 Sep 89 17:30:30 GMT Sender: root@rice.edu Organization: Sun-Spots Lines: 63 Approved: Sun-Spots@rice.edu X-Sun-Spots-Digest: Volume 8, Issue 112, message 11 of 14