KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Article: Q44465
Product(s): See article
Version(s): 3.x 4.06 4.07 5.0x 5.10 5.13 | 5.01.21 5.02 5.03 5.10 5.1
Operating System(s): MS-DOS | OS/2
Keyword(s): ENDUSER | s_lib | mspl13_basic
Last Modified: 24-JAN-1991

All variables and routines in a module within a library will be linked
into a program when any single variable or routine residing in that
module is referenced. This can cause the following linker error if two
or more modules contain definitions for the same symbol:

   L2025  symbol defined more than once

For example, in the diagram below, module1 contains routines "a", "b",
and "c". The module2 contains routines "c", "d", and "e". When main()
references "a" and "e", the linker links module1 and module2 from the
library. This results in "c" being defined twice. Removing "c" from
one of the modules, recompiling the module, and replacing the module
in the library with the LIB utility operator "-+" will prevent "c"
from being multiply defined.

                        +-----------+
                        |           |
                        | calls "a" |
                        | calls "e" |
                      / |           | \
                     /  +-----------+  \
                    /       main()      \
                   v                     v
               +-------+             +-------+
               |   a   |             |   c   |
               |   b   |             |   d   |
               |   c   |             |   e   |
               |       |             |       |
               +-------+             +-------+
                module1               module2

For each routine you want to be linked separately, compile a separate
object file and add it to the library.






Microsoft `M' Editor
=============================================================================

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.

Copyright Microsoft Corporation 1986-2002.