KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q50524: C Run-Time Routines Cannot Be Placed in an Overlay

Article: Q50524
Product(s): See article
Version(s): 5.10
Operating System(s): MS-DOS
Keyword(s): ENDUSER | S_QuickC S_QuickASM | mspl13_c
Last Modified: 30-NOV-1989

Problem:

I want to extract a routine from the C Run-Time Library and put it in
an overlay. The program compiles and links without warnings or errors,
but when I run the program, my machine hangs.

Response:

The run-time routines for medium and large models (the only ones that
overlays deal with) are compiled with /NT _TEXT. This puts all the
routines in the same named segment. The linker cannot split a segment
between the root and overlay. Segmentation takes precedence over
overlays. The linker constructs overlays from segments, not individual
functions.

The first request for the segment (in an .OBJ that goes in root or in
an overlay) determines where the linker will place the entire segment
(root or overlay). If your extracted .OBJ is in the overlay, all the
run time gets put into the overlay.

Consequently, the entry point of the overlay manager is put into the
overlay and not in the root, so the overlay manager code (also in
_TEXT) is not present in memory at start up. This causes the machine
to hang.

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.