[comp.sys.ibm.pc] How do I call MS FORTRAN from MS C?

LC.YRS@forsythe.stanford.edu (Richard Stanton) (02/06/90)

If I have a .OBJ file that apparently is a compiled MS FORTRAN
subroutine, how do I link it into a MS C main program? I have tried
declaring the function name with the "fortran" keyword, but the
linker keeps wanting to look for FORTRAN.LIB, and complains about a
few doubly defined symbols. I also get a few segment fixup errors,
and the program does not run.

What am I missing?

Richard Stanton

risto@tuura.UUCP (Risto Lankinen) (02/07/90)

LC.YRS@forsythe.stanford.edu (Richard Stanton) writes:

>If I have a .OBJ file that apparently is a compiled MS FORTRAN
>subroutine, how do I link it into a MS C main program? I have tried
>declaring the function name with the "fortran" keyword, but the
>linker keeps wanting to look for FORTRAN.LIB, and complains about a
>few doubly defined symbols. I also get a few segment fixup errors,
>and the program does not run.

>What am I missing?

I think you're missing the FORTRAN.LIB :->  Seriously, the .OBJ
created by the Fortran compiler seems to have references to the
library file of the compiler.  There may (and almost certainly
is) a call to a function, to which Fortran could not generate
intrinsic code but used a call instead.  Now that you do not have
(do you?) the FORTRAN.LIB, the linker (and *not* the C-compiler)
does not know where to find code for that/those external call/-s.

The fix is to use the FORTRAN.LIB of the compiler the .OBJ was
done with, then compile the C-code and to offer the FORTRAN.LIB
as an additional library to search code for external calls to
the LINKer.

terveisin: Risto Lankinen
-- 

cruz@autarch.acsu.buffalo.edu (pedro cruz) (02/08/90)

In article <7894@lindy.Stanford.EDU>, LC.YRS@forsythe.stanford.edu
(Richard Stanton) writes:
> If I have a .OBJ file that apparently is a compiled MS FORTRAN
> subroutine, how do I link it into a MS C main program? I have tried
> declaring the function name with the "fortran" keyword, but the
> linker keeps wanting to look for FORTRAN.LIB, and complains about a
> few doubly defined symbols. I also get a few segment fixup errors,
> and the program does not run.
> 
> What am I missing?
> 
> Richard Stanton

Hi:

	You are missing the fortran.lib file that comes with the fortran
compiler. When the ms-dos linker ask you for the libraries to include
put that library in the line plus any c libraries you need. Hope this help.

Pete Cruz