silvert@dalcs.UUCP (Bill Silvert) (09/05/88)
Recently a question was posted by pete@agate about liniking Microsoft C
with Fortran. I was unable to reach him by mail, but I feel that the
following may be useful enough to post, so here it is.
I've been calling C 5.1 from Fortran 4.10 strictly by the book.
The options I use aren't at hand, but I think that in adition to /NOE I
also use /NOD or whatever suppresses the default libraries. I link with
llibfore.lib+llibce.lib.
Remember that you have to identify the intefacing either with an
INTERFACE module in Fortran or the proper calling ID in C. Since I am
calling C from Fortran, I declare things as "int fortran xxx" and the
calls are OK. I have no experience with calling Fortran from C, but I
found that the mixed language guide that came with the fortran 4.10 was
quite clear.
The precise procedure I follow is to compile both the C and Fortran
modules with the /c option and then use the LINK.EXE that came with
the Fortran. It is a larger LINK.EXE than the one that comes with C.
I haven't tried the LINK.EXE that comes with C, and I have no idea why the
files are different, since the mixed language instructions seem the same.
--
Bill Silvert, Habitat Ecology Division.
Bedford Institute of Oceanography, Dartmouth, NS, Canada B2Y 4A2
UUCP: ...!{uunet,utai,watmath}!dalcs!biomel!bill
CDN: biomel@cs.dal.CDN BITNET: bs%dalcs@dalac.BITNET