From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,77e6acc9c025909b X-Google-Attributes: gidfee84,public X-Google-ArrivalTime: 1994-08-01 15:49:09 PST Path: bga.com!news.sprintlink.net!hookup!ames!elroy.jpl.nasa.gov!usc!howland.reston.ans.net!europa.eng.gtefsd.com!news.uoregon.edu!netnews.nwnet.net!news.u.washington.edu!trieste.stat.washington.edu!neal From: neal@trieste.stat.washington.edu (Phil Neal) Newsgroups: comp.unix.osf.osf1 Subject: Mixed language programming Date: 1 Aug 1994 22:35:16 GMT Organization: U. Washington Dept. of Statistics Message-ID: <31jtb4$f1a@news.u.washington.edu> NNTP-Posting-Host: trieste.stat.washington.edu X-Newsreader: TIN [version 1.2 PL2] Dear osf1/alpha people, I have been having a problem trying to make a program with a C main and a f77 subroutine. I have been through the man pages and the dxbook stuff for f77. It gives examples for f77 calling C but never C calling f77. Any pointers would be extremely appreciated (no pun intended). Here is the main: extern testit_(); main() { testit_(); printf(" back again \n"); } And here is the subroutine: subroutine testit() write(*,*) ' in testit' return end Here is the make file: test.exe: test.o testit.o f77 -v test.o testit.o -o test.exe clean: rm *.o *.exe Here is the error message: _trieste_215% make cc -c test.c f77 -c testit.f f77 -v test.o testit.o -o test.exe /usr/bin/cc -v -o test.exe /usr/lib/cmplrs/fort/for_main.o -O4 test.o testit.o -nocount -lUfor -lfor -lFutil -lm -lots /usr/lib/cmplrs/cc/ld -o test.exe -g0 -O4 -call_shared /usr/lib/cmplrs/cc/crt0.o /usr/lib/cmplrs/fort/for_main.o test.o testit.o -nocount -lUfor -lfor -lFutil -lm -lots -lc ld: test.o: main: multiply defined Unresolved: MAIN__ 0.0u 0.0s 0:00 60% 0+8k 3+5io 22pf+0w fort: Severe: Failed while trying to link. *** Exit 1 Stop. Phil ---------------------------------------------------------------- Phil Neal, Systems Programmer, Statistics Department GN-22 University of Washington, Seattle, Wa. 98195 USA | 206-685-1627 http://www.stat.washington.edu/phil.html ---------------------------------------------------------------- Those who would repeat the past must control the teaching of history. (Bene Gesserit Coda)