home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / unix / cray / 251 < prev    next >
Encoding:
Text File  |  1992-08-27  |  2.0 KB  |  67 lines

  1. Xref: sparky comp.unix.cray:251 comp.sys.super:918
  2. Path: sparky!uunet!europa.asd.contel.com!darwin.sura.net!dtix!mimsy!afterlife!relay!k30b!kcables
  3. From: kcables@k30b.nswc.navy.mil (k30b)
  4. Newsgroups: comp.unix.cray,comp.sys.super
  5. Subject: Executing 'segldr' with object files of different types
  6. Message-ID: <1992Aug27.172853.5546@relay.nswc.navy.mil>
  7. Date: 27 Aug 92 17:28:53 GMT
  8. References: <1992Aug17.234228.16195@leland.Stanford.EDU> <71317@apple.Apple.COM>
  9. Sender: news@relay.nswc.navy.mil
  10. Organization: NSWC, Dahlgren, VA
  11. Lines: 54
  12.  
  13.  
  14.     We have a Cray Y-MP running Unicos 6.0, CF77 version 5.0, and
  15. Cray Standard C release 3.0.  I have a C driver that calls a FORTRAN
  16. subroutine with common data between the two (i.e., a C struct defined
  17. outside the main, and a corresponding FORTRAN common block).  What I'm
  18. trying to do is execute 'segldr' with the -f option set to '-indef', so
  19. that any unitialized common variables are supposed to be 10605054(octal).
  20. When I execute 'segldr' with the two .o files, however, and print out
  21. the common variables in the C program before calling the FORTRAN
  22. subroutine, they are coming out 0.  If I take out the call to the FORTRAN
  23. routine, recompile and segldr again, they come out negative indefinite --
  24. the same is true if I make the FORTRAN routine a standalone program.
  25.  
  26. Is there something special that must be done with segldr to get it to
  27. work with object files generated by different types of compilers, or
  28. am I completely missing something?
  29.  
  30. Here's the C code:
  31. -----------------------------------
  32. #include <stdio.h>
  33. struct {
  34.     int a;
  35.     float b;
  36. }
  37. CB;
  38. main()
  39. {
  40.     printf("in main, before WRITDAT, a= %o b= %o\n",CB.a,CB.b);
  41.     WRITDAT();
  42. }
  43.  
  44. And the FORTRAN code:
  45. -------------------------------------
  46.     SUBROUTINE WRITDAT
  47.     COMMON /CB/ A, B
  48.     INTEGER A
  49.     REAL B
  50.  100    FORMAT(O64)
  51.     PRINT *, 'IN WRITDAT:'
  52.     WRITE (*,100) A
  53.     WRITE (*,100) B
  54.     RETURN
  55.     END
  56.  
  57. Then to compile and load:
  58.  
  59. cc -c dum.c
  60. cft77 writdat.f
  61. segldr -f -indef -o xxx dum.o writdat.o
  62.  
  63. Thanks,
  64. Kathryn Cables
  65. Naval Surface Warfare Center
  66. kcables@relay.nswc.navy.mil
  67.