home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!relay!afterlife!adm!news
- From: fred@poly2.nist.gov (Frederick R. Phelan Jr.)
- Newsgroups: comp.sys.sgi
- Subject: Mixed cc and f77 problems
- Message-ID: <31574@adm.brl.mil>
- Date: 29 Jul 92 12:07:48 GMT
- Sender: news@adm.brl.mil
- Lines: 88
-
-
- This is a prototype of a problem I am
- having trying to use existing f77
- read/write subroutines, with graphics
- code written in c.
-
- Here are three file definitions for main.c,
- IOstuff.f and test.dat ... main.c attempts
- to read an integer value from test.dat using
- the subroutine read_val defined in IOstuff.f ...
-
- (1) main.c :
- #include <stdio.h>
- #include <stdlib.h>
- #include <math.h>
-
- void read_val_(int);
-
- int a;
-
- main()
- {
- read_val_(a);
- printf("a = %d\n",a);
- }
-
-
- (2) IOstuff.f :
- subroutine read_val(a)
- integer a
-
- read(5,1000) a
- 1000 format(I2)
-
- return
- end
-
- (3) test.dat :
- 3
-
-
- Problem 1:
- ----------
- If I compile with
-
- cc -o Mix1.exe main.c IOstuff.f -lm
-
- and then do
-
- Mix1.exe < test.dat
-
- it returns the answer
-
- a = 0
-
- when according to test.dat a should = 3.
-
- Problem 2:
- ----------
- If I compile with
-
- cc -c main.c -lm
- f77 -c IOstuff.f
- cc -o Mix2.exe main.o IOstuff.o -lm
-
- I get the error messages
-
- /usr/bin/ld:
- Undefined:
- s_rsfe
- do_fio
- e_rsfe
-
-
- I'd prefer the second way of compiling in parts,
- since the IO programs have been written for a
- long time and have no need of edit/recompile.
-
- Any clues are appreciated.
-
- ---
- Fred Phelan
- fred@poly2.nist.gov
- /*___________________________________________________
- ____ __ ___ __ ___ ___ ___
- /__ /_/ /__ / / /__/ /__/ /__ / /__/ /\ /
- / / ( /__ /_/ / / / /___ /___ / / / \/
- ___________________________________________________*/
-