BUG: L2025: __fltin with Mixed Language FORTRAN and C

ID: Q85304

5.00 5.10 | 5.00 5.10

MS-DOS    | OS/2
kbinterop

The information in this article applies to:

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 KBSubcategory: LinkIss
Keywords          : kberrmsg LinkIss 
Version           : 5.00 5.10 | 5.00 5.10
Platform          : MS-DOS OS/2

Last Reviewed: May 22, 1998