BUG: L2025: __fltin with Mixed Language FORTRAN and C

Last reviewed: February 6, 1997
Article ID: Q85304
The information in this article applies to:
  • Microsoft FORTRAN for MS-DOS, versions 5.0 and 5.1
  • Microsoft FORTRAN for OS/2, versions 5.0 and 5.1

SYMPTOMS

When 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 once

Under 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.

CAUSE

The 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.

RESOLUTION

The 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.

STATUS

Microsoft 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 INFORMATION

The following code reproduces the problem:

Sample Code 1

c 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.for

ctest.obj: ctest.c
  cl /c /AL ctest.c

test.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
KBCategory: kbinterop kbbuglist kberrmsg
KBSubcategory: LinkIss


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 6, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.