Microsoft KB Archive/58098
Article ID: 58098
Article Last Modified on 9/30/2003
- Microsoft LINK for MS-DOS 2.x
- Microsoft LINK for MS-DOS 3.x
- Microsoft LINK for MS-DOS 4.x
- Microsoft LINK for MS-DOS 5.0x
- Microsoft LINK for MS-DOS 5.1
- Microsoft LINK for MS-DOS 5.11
- Microsoft LINK for MS-DOS 5.13
- Microsoft LINK for MS-DOS 5.15
- Microsoft LINK for MS-DOS 5.2
- Microsoft LINK for MS-DOS 5.3x
- Microsoft LINK for MS-DOS 5.5
- Microsoft LINK for MS-DOS 5.6
This article was previously published under Q58098
Microsoft LINK does not support using a function pointer to call a function in a static overlay unless the function is called from the same overlay. If an overlaid function is called from the root or from a different overlay, it cannot be called through a pointer.
Static overlays do not support calling an overlaid function indirectly through a pointer because the loader determines the address of the indirect function at load time.
Versions of Microsoft LINK prior to version 5.3 support only static overlays. LINK version 5.3 introduced MOVE (Microsoft Overlaid Virtual Environment) dynamic overlays that do support calling an overlaid function through a pointer. Microsoft LINK versions 5.3x, 5.5, and 5.6 can still generate static overlays using the /OLD[OVERLAY] command line switch. The same issue of lack of support for calling an overlaid function through a function pointer still applies to these later versions.
In an application with static overlays, the linker recognizes a normal function call (one that does not take place through a pointer) and places an interrupt call into the executable file instead of the function call. At run time, the interrupt gives control to the overlay manager which determines if the correct overlay is loaded in memory, loads the overlay if necessary, and calls the function. Because the object module contains a fixup record for the function call, the linker can set the interrupts as required.
On the other hand, when an application uses a function pointer, the compiler creates a fixup record for the address to which the pointer refers. However, the fixup record does not indicate that the record provides the address for a function. Therefore, if the function is linked as an overlay, the linker does not call the overlay manager but performs a standard fixup.
Consequently, if an application calls a function located in an overlay that is not loaded in memory, the overlay manager is not called to load the overlay. Instead, the application passes control to the random data located at the destination address and disaster can easily result.
Additional query words: kbinf 4.06 4.07 4.10 5.01.20 5.01.21 5.02 5.03 5.05 5.10 5.11 5.13 5.15 5.20 5.30 5.31.009 5.50 5.60
Keywords: kb16bitonly KB58098