Symbol Defined More than Once Linking with FORTRAN Library

Product Version(s): 3.3x
Operating System:   MS-DOS
Flags: ENDUSER | TAR56929
Last Modified:  3-OCT-1988    ArticleIdent: Q11984

Question:

In the process of adding a Pascal language-user interface to our
FORTRAN language system, a run-time library compatibility problem has
surfaced. Any time we search both run-time libraries during a link, a
"Symbol defined more than once: `SUBSQQ'" error is reported in the
second run-time library searched.

This is both an operational problem (our MAKEs terminate at the error)
and a potential run-time problem. The only run-time problem we know
about is when the FORTRAN substring is used (i.e.,  TEST(I:I)=' ') and
the Pascal library is searched first. This will generally lock up a
system at run-time.

We would like to know the following:

1. Is there a fix for the libraries?

2. Is there a potential Pascal run-time problem when we link the
   FORTRAN library first to solve the FORTRAN substring crash?

Response:

No. You are not likely to have a problem in using the executable that
you created.

For the first problem, with the MAKE file, you should use conditional
execution based on whether or not you receive certain error levels.

With regards to the library problem, the information that you sent
would suggest that you have a FORTRAN main program that calls Pascal
routines that, for example, provide a user interface to your system.
But there is something in the structure of your program that tangles
the linker, which is NOT your fault.

If you look at the contents of the FORTRAN and Pascal libraries using
the "LIB" utility, you can see that the function SUBSQQ is present in
both PASCAL.LIB and FORTRAN.LIB. You can see that the object module
that contains the SUBSQQ function in the Pascal library contains many
other entry points, in contrast to the FORTRAN object module
containing SUBSQQ, which only has three entry points.

PASCAL.LIB:

sets              Offset: 000101d0H  Code and data size: 4c5H
  ADDSQQ            CEQSQQ            CLESQQ            CLTSQQ
  MIN               MULSQQ            O3ESQQ            SETSQQ
 *SUBSQQ*           T3OSQQ            Z3RSQQ

FORTRAN.LIB:

fstl              Offset: 0000fb00H  Code and data size: 19eH
  FCPSQQ            FSTLQQ            SUBSQQ

An entry point is not necessarily a function. For example, in the
FORTRAN library module containing SUBSQQ, FCPSQQ is actually a module
name, while SUBSQQ is a procedure and FSTLQQ a function.

Your program uses at least one entry point contained in both of these
two modules. The entry point does not necessarily have to be SUBSQQ.

For example, if you link the Pascal library First, then the FORTRAN
library, and if your program generates calls to ADDSQQ and FSTLQQ, the
linker will first pull in the "sets" module from the PASCAL.LIB to
resolve the reference to ADDSQQ. Then it would have to pull in the
"fstl" module from the FORTRAN.LIB to resolve the reference to FSTLQQ.
Then it will check all of its entry points for duplicates. The linker
would find that now it has duplicates of the SUBSQQ procedure, and
generate a message that you have pulled in two (possibly different)
versions of SUBSQQ.

This process should not generate a fatal error, and you should be able
to proceed. If it is fatal and hangs your machine, try switching your
link order.

Because you are using two Microsoft compilers, and because you are
using the same version number of two particularly compatible compilers
(they share the same source code for many routines), the process
should work properly.

The SUBSQQ procedure is identical in the FORTRAN and
Pascal Version 3.31.

You should proceed with the executable that you created by linking in
FORTRAN first and then PASCAL. You should not have any problems.
