From: btbg1194@uxa.cso.uiuc.edu (Bradley T Banko)
Subject: Mixed Language MS C calls MS FORTRAN (link errors!?)
Organization: University of Illinois at Urbana
Date: Wed, 11 Nov 1992 07:28:24 GMT


I am having some problems trying to do some mixed language programming
using MS C (5.0) to call MS FORTRAN (5.1) functions.  I think that I have
sorted out all of the "language interface" problems (passing C variables
by reference, etc.) and I have one C test program which compiles and links
and runs with the Fortran subroutines just fine.  
I wrote a second program to test the Fortran subroutines, and I get a 
bunch of *link* time errors:

	L2025 symbol defined more than once

and finally, it tells me that the fortran subroutine interface prototypes
are improper or missing.  There is almost *no* difference between these
two simple test programs.

I have the libraries LLIBFORE.LIB and LLIBCE.LIB in the path, and have used
both the V3.61 and V5.16 linkers with similar results.

I compile the FORTRAN file with:

		fl /c file.for	(I have tried "fl /FPc /c" also)

I compile the C program with:

		cl /AL /c cfile.c

and link with:

		link cfile+cfile,,,,,,,,	(all defaults)

in the case of one test program, I get a bunch of "symbol redefined errors",
and in the second case I get *no* errors.  (I will include the linker outputs
below for the curious.)

Thanks in advance for any advice or comments to:  b-banko@uiuc.edu

Brad Banko

tstrdwrt.c:
======================================================================
Microsoft (R) Segmented-Executable Linker  Version 5.15
Copyright (C) Microsoft Corp 1984-1991.  All rights reserved.

Object Modules [.OBJ]: /NOE tstrdwrt rdwrtcp,,,,,
======================================================================

rwcopy.c:
======================================================================
Microsoft (R) Segmented-Executable Linker  Version 5.15
Copyright (C) Microsoft Corp 1984-1991.  All rights reserved.

Object Modules [.OBJ]: /NOE rwcopy rdwrtcp,,,,,C:\FORTRAN\LIB\LLIBFOR7.lib(dos\crt0.asm) : error L2025: __aexit_rtn : symbol defined more than once
C:\FORTRAN\LIB\LLIBFOR7.lib(dos\crt0.asm) : error L2025: __asizds : symbol defined more than once
C:\FORTRAN\LIB\LLIBFOR7.lib(dos\crt0.asm) : error L2025: __astart : symbol defined more than once
C:\FORTRAN\LIB\LLIBFOR7.lib(dos\crt0.asm) : error L2025: __atopsp : symbol defined more than once
C:\FORTRAN\LIB\LLIBFOR7.lib(dos\crt0.asm) : error L2025: __cintDIV : symbol defined more than once
C:\FORTRAN\LIB\LLIBFOR7.lib(dos\crt0.asm) : error L2025: __amsg_exit : symbol defined more than once
C:\FORTRAN\LIB\LLIBFOR7.lib(dos\crt0dat.asm) : error L2025: __osversion : symbol defined more than once
...
C:\FORTRAN\LIB\LLIBFOR7.lib(dos\crt0dat.asm) : error L2025: __umaskval : symbol defined more than once
C:\FORTRAN\LIB\LLIBFOR7.lib(dos\crt0dat.asm) : error L2025: __ctermsub : symbol defined more than once
C:\FORTRAN\LIB\LLIBFOR7.lib(dos\crt0dat.asm) : error L2025: __doserrno : symbol defined more than once
C:\FORTRAN\LIB\LLIBFOR7.lib(dos\crt0dat.asm) : error L2025: __fac : symbol defined more than once
C:\FORTRAN\LIB\LLIBFOR7.lib(dos\crt0dat.asm) : error L2025: _exit : symbol defined more than once
C:\FORTRAN\LIB\LLIBFOR7.lib(dos\crt0dat.asm) : error L2025: __psp : symbol defined more than once

rwcopy.obj(rwcopy.c) : error L2052: '_readfl' : unresolved external; possible calling convention mismatch
rwcopy.obj(rwcopy.c) : error L2052: '_writfl' : unresolved external; possible calling convention mismatch


There were 72 errors detected
======================================================================
-- 
Brad Banko;  Dept of Physics;  U of Illinois;  b-banko@uiuc.edu
=========================================================================
Tatiana Gutsu for President!                     73 de kb8cne @ n9lnq.il
Wanted:  Italian pagan Catholic woman.  Inquire within.
Newsgroups: alt.msdos.programmer