KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q58961: If .DLL Is Linked with CRTLIB, Then .EXE Must Be Linked, Too

Article: Q58961
Product(s): See article
Version(s): 5.10
Operating System(s): OS/2
Keyword(s): ENDUSER | | mspl13_c
Last Modified: 6-MAR-1990

When you write a program that uses a DLL that has been linked with
CRTLIB.DLL, then the program itself must also link with CRTLIB.DLL.
The diagram and text in Section 5.2 of MTDYNA.DOC explain this close
relationship in detail.

Also in MTDYNA.DOC, the table in Section 6 is very useful for
identifying which components to use for which type of output file
(.EXE or .DLL). The following is a diagram of the library
relationships in the table:

               +---------+       |                    +---------+
           /   | xLIBCyP |       |                /   | LLIBCDLL|
       single  +---------+       |            single  +---------+
+-----+/  thread                 |     +-----+/  thread
| EXE |                          |     | DLL |
+-\---+\                         |     +-----+\
  multiple                       |           multiple
    thread     +---------+       |             thread +---------+
     \      \  | LLIBCMT |       |                \   | CRTLIB  |
      \ (or)   +---------+       |                    +---------+
       \ ________________________________________________/

As long as the .EXE is independent of any DLLs, it links with either
xLIBCyP.LIB or LLIBCMT.LIB, depending on whether the .EXE is single or
multithreaded. When the .EXE uses a DLL, the .EXE links with either
xLIBCyP.LIB or CRTLIB.LIB, depending on whether the DLL is single or
multithreaded.

Additional .OBJs and .LIBs are linked for multithreaded .EXEs and for
single and multithreaded DLLs. You can find complete detailed
information about compiling and linking multithreaded programs and
dynamic link libraries in MTDYNA.DOC, which is provided on the C 5.10
disks.

For further information, query on the following words:

   CRTLIB and DLL

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.