"Symbol Defined More Than Once: SUBSQQ" Error
PSS ID Number: Q11985
Article last modified on 01-02-1991
PSS database name: S_PasCal

3.04

MS-DOS


Question:

While adding a Pascal language-user interface to our FORTRAN language
system, a run-time library compatibility problem has surfaced. When 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 of
occurs when the FORTRAN substring is used (for example, TEST(I:I)=' ')
and the Pascal library is searched first. This problem will generally
lock up a system at run time.

We would like to know the following:

1. Is there a patch 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 using the executable 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.

In regard to the library problem, you may have a FORTRAN main program
that calls Pascal routines that, for example, provide a user interface
to your system. However, there may be something in the structure of
your program that tangles the linker.

Examine 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 also can see that the object module
contains the SUBSQQ function in the Pascal library, which contains
many other entry points. This is in contrast to the FORTRAN object
module containing SUBSQQ, which only has three entry points. The
following is an example:

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 need to be SUBSQQ.

For example, if you first link in the Pascal library and 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. The linker then must
pull in the "fstl" module from the FORTRAN.LIB to resolve the
reference to FSTLQQ. The linker will then check all its entry points
for duplicates, 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 procedure should generate a fatal error and make it impossible
for you to proceed. If this occurs and your machine hangs, try
switching your link order. Everything should work properly because you
are using two Microsoft compilers, as well as using the same version
number of two particularly compatible compilers (they share the same
source code for many routines). In fact, the SUBSQQ procedure is
indeed identical in FORTRAN and Pascal version 3.31.

We recommend that you proceed with the executable you created by
linking in FORTRAN first, then Pascal. You should not encounter any
problems using this procedure.

Copyright Microsoft Corporation 1991.