home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / sys / sun / apps / 2773 < prev    next >
Encoding:
Internet Message Format  |  1992-12-16  |  1.3 KB

  1. Path: sparky!uunet!olivea!spool.mu.edu!agate!ames!nsisrv!thuja!karl
  2. From: karl@thuja.gsfc.nasa.gov (Karl A. Anderson)
  3. Newsgroups: comp.sys.sun.apps
  4. Subject: Linking Fortran subroutine with C main program: "Compilation failed"
  5. Message-ID: <1992Dec16.135730.19707@nsisrv.gsfc.nasa.gov>
  6. Date: 16 Dec 92 13:57:30 GMT
  7. Sender: karl@thuja (Karl A. Anderson)
  8. Organization: NASA/GSFC Laboratory for Terrestrial Physics
  9. Lines: 28
  10. Nntp-Posting-Host: thuja.gsfc.nasa.gov
  11.  
  12. The Sun Fortran User's Guide (p. 159) offers an example of how to call a fortran
  13. subroutine from a C main program.  You compile SimRef.f and SimRefmain.c to
  14. object files separately, then link with "f77 SimRef.o SimRefmain.o".  When we try
  15. this, we get the following error message:
  16.  
  17. %ls
  18. SimRef.f      SimRefmain.c
  19. %f77 -c SimRef.f
  20. SimRef.f:
  21.         simref:
  22. %cc -c SimRefmain.c
  23. %f77 SimRef.o SimRefmain.o
  24. ld: Undefined symbol
  25.    _MAIN_
  26. Compilation failed
  27.  
  28. LD_LIBRARY_PATH is set correctly:
  29.  
  30. %echo $LD_LIBRARY_PATH
  31. /usr/lang/SC1.0:/usr/lib:/usr/lib/X11:/usr/openwin/lib
  32.  
  33. Despite the error message, a.out is created, and seems to work.  Anybody have any
  34. ideas why we're getting the error?  TIA.
  35.  
  36. -- 
  37. Karl A. Anderson        | Internet: karl@thuja.gsfc.nasa.gov
  38. NASA/GSFC code 920.2 (HSTX)    | voice: (301) 286-3815
  39. Greenbelt, MD 20771        | #include "std_disclaimer"
  40.