home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / sys / sgi / 11576 < prev    next >
Encoding:
Text File  |  1992-07-29  |  1.7 KB  |  98 lines

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!relay!afterlife!adm!news
  2. From: fred@poly2.nist.gov (Frederick R. Phelan Jr.)
  3. Newsgroups: comp.sys.sgi
  4. Subject: Mixed cc and f77 problems
  5. Message-ID: <31574@adm.brl.mil>
  6. Date: 29 Jul 92 12:07:48 GMT
  7. Sender: news@adm.brl.mil
  8. Lines: 88
  9.  
  10.  
  11. This is a prototype of a problem I am
  12. having trying to use existing f77 
  13. read/write subroutines, with graphics
  14. code written in c.
  15.  
  16. Here are three file definitions for main.c,
  17. IOstuff.f and test.dat ... main.c attempts
  18. to read an integer value from test.dat using
  19. the subroutine read_val defined in IOstuff.f ...
  20.  
  21. (1) main.c :
  22. #include <stdio.h>
  23. #include <stdlib.h>
  24. #include <math.h>
  25.  
  26. void read_val_(int);
  27.  
  28. int a;
  29.  
  30. main()
  31. {
  32.   read_val_(a);
  33.   printf("a = %d\n",a);
  34. }
  35.  
  36.  
  37. (2) IOstuff.f :
  38.       subroutine read_val(a)
  39.       integer a
  40.  
  41.       read(5,1000) a
  42.  1000 format(I2)
  43.  
  44.       return
  45.       end
  46.  
  47. (3) test.dat :
  48.  3
  49.  
  50.  
  51. Problem 1:
  52. ----------
  53. If I compile with
  54.  
  55.     cc -o Mix1.exe main.c IOstuff.f -lm
  56.  
  57. and then do 
  58.  
  59.     Mix1.exe < test.dat
  60.  
  61. it returns the answer
  62.  
  63.     a = 0
  64.  
  65. when according to test.dat a should = 3.
  66.  
  67. Problem 2:
  68. ----------
  69. If I compile with
  70.  
  71.     cc -c main.c -lm
  72.     f77 -c IOstuff.f
  73.     cc -o Mix2.exe main.o IOstuff.o -lm
  74.  
  75. I get the error messages
  76.  
  77.     /usr/bin/ld:
  78.     Undefined:
  79.     s_rsfe
  80.     do_fio
  81.     e_rsfe
  82.  
  83.  
  84. I'd prefer the second way of compiling in parts,
  85. since the IO programs have been written for a 
  86. long time and have no need of edit/recompile.
  87.  
  88. Any clues are appreciated.
  89.  
  90. ---
  91. Fred Phelan
  92. fred@poly2.nist.gov
  93. /*___________________________________________________
  94.    ____ __  ___  __    ___       ___        ___ 
  95.   /__  /_/ /__  / /   /__/ /__/ /__   /    /__/ /\  /  
  96.  /    / ( /__  /_/   /    /  / /___  /___ /  / /  \/
  97. ___________________________________________________*/
  98.