BUG: L2025: __fltin with Mixed Language FORTRAN and CLast reviewed: February 6, 1997Article ID: Q85304 |
The information in this article applies to:
SYMPTOMSWhen linking code compiled with Microsoft FORTRAN version 5.0 or 5.1 that uses a READ involving a REAL variable, with code compiled with Microsoft C version 6.0, 6.0a, 6.0ax, or 7.0 that uses any floating-point operation, the following error may occur:
llibforx.lib(\mrt\c\cfin.ASM) : error L2025: __fltin : symbol defined more than onceUnder MS-DOS, the resulting executable runs without error. Under Windows and OS/2, the resulting executable doesn't load due to the error bit in the executable file's header.
CAUSEThe FORTRAN run-time library contains an object module CFIN.OBJ with two functions: __fltin and __fltinf. The C run-time library contains the module CFINN, which only contains the function __fltin. When the C run-time library must precede the FORTRAN run-time library on the link line, as is the case when mixing C 6.0 with FORTRAN 5.0, or C 7.0 and FORTRAN 5.1, the linker initially finds the __fltin function in the C library. When the linker later needs to resolve the __fltinf function, the entire CFIN module is included in the executable. This causes the __fltin symbol to be defined again. The link option /NOE has no effect in situations like this.
RESOLUTIONThe L2025 error can be eliminated by removing CFINN.OBJ from the C run-time library using the library manager LIB.EXE. It is also possible to clear the error bit in the executable file's header by using the EXEHDR utility with the /R option. Clearing this bit allows the program to execute correctly under Windows and OS/2.
STATUSMicrosoft has confirmed this to be a problem in Microsoft FORTRAN versions 5.0 and 5.1 for MS-DOS and OS/2, and Microsoft C versions 6.0, 6.0a, 6.0ax, and 7.0.
MORE INFORMATIONThe following code reproduces the problem:
Sample Code 1c FORTTEST.FOR:
subroutine test real x read(*,*) x return end Sample Code 2
/* CTEST.C: */ #include <stdlib.h> #include <stdio.h> void extern fortran test(void); void main(void){
char *s;double x;
s = "-2309.12E-15"; x = atof(s); test(); /* FORTRAN call */ }
Sample Code 3# C 7.0, FORTRAN 5.1 MAKEFILE: all: test.exe forttest.obj: forttest.for fl /c forttest.forctest.obj: ctest.c cl /c /AL ctest.ctest.exe: ctest.obj forttest.obj link /nod /noe ctest+forttest,test,nul,llibce llibfore oldnames; |
Additional reference words: 6.00 6.00a 6.00ax 7.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |