home *** CD-ROM | disk | FTP | other *** search
- Xref: sparky comp.unix.cray:251 comp.sys.super:918
- Path: sparky!uunet!europa.asd.contel.com!darwin.sura.net!dtix!mimsy!afterlife!relay!k30b!kcables
- From: kcables@k30b.nswc.navy.mil (k30b)
- Newsgroups: comp.unix.cray,comp.sys.super
- Subject: Executing 'segldr' with object files of different types
- Message-ID: <1992Aug27.172853.5546@relay.nswc.navy.mil>
- Date: 27 Aug 92 17:28:53 GMT
- References: <1992Aug17.234228.16195@leland.Stanford.EDU> <71317@apple.Apple.COM>
- Sender: news@relay.nswc.navy.mil
- Organization: NSWC, Dahlgren, VA
- Lines: 54
-
-
- We have a Cray Y-MP running Unicos 6.0, CF77 version 5.0, and
- Cray Standard C release 3.0. I have a C driver that calls a FORTRAN
- subroutine with common data between the two (i.e., a C struct defined
- outside the main, and a corresponding FORTRAN common block). What I'm
- trying to do is execute 'segldr' with the -f option set to '-indef', so
- that any unitialized common variables are supposed to be 10605054(octal).
- When I execute 'segldr' with the two .o files, however, and print out
- the common variables in the C program before calling the FORTRAN
- subroutine, they are coming out 0. If I take out the call to the FORTRAN
- routine, recompile and segldr again, they come out negative indefinite --
- the same is true if I make the FORTRAN routine a standalone program.
-
- Is there something special that must be done with segldr to get it to
- work with object files generated by different types of compilers, or
- am I completely missing something?
-
- Here's the C code:
- -----------------------------------
- #include <stdio.h>
- struct {
- int a;
- float b;
- }
- CB;
- main()
- {
- printf("in main, before WRITDAT, a= %o b= %o\n",CB.a,CB.b);
- WRITDAT();
- }
-
- And the FORTRAN code:
- -------------------------------------
- SUBROUTINE WRITDAT
- COMMON /CB/ A, B
- INTEGER A
- REAL B
- 100 FORMAT(O64)
- PRINT *, 'IN WRITDAT:'
- WRITE (*,100) A
- WRITE (*,100) B
- RETURN
- END
-
- Then to compile and load:
-
- cc -c dum.c
- cft77 writdat.f
- segldr -f -indef -o xxx dum.o writdat.o
-
- Thanks,
- Kathryn Cables
- Naval Surface Warfare Center
- kcables@relay.nswc.navy.mil
-