ID: Q87940
5.30 5.31 MS-DOS kbtool kbbuglist kbfixlist
The information in this article applies to:
An attempt to assign a packaged function to a segment fails and Microsoft LINK creates an empty segment in the executable file. An attempt to move the segment into an overlay successfully places the empty segment into the specified overlay, but the function remains in the resident (root) portion of the application.
Modify the module-definition (.DEF) file to use the following syntax to place a packaged function into an overlay:
FUNCTIONS:1 _func1 _func2
To assign a function to another segment or to change the ordering
of the functions in a segment, modify the source code to change the
placement or order of the functions, as appropriate.
Microsoft has confirmed this to be a problem in LINK versions 5.3 and 5.31.009 for MS-DOS. This problem was corrected in LINK version 5.5 for MS- DOS.
According to page 625 of the Microsoft C/C++ "Environment and Tools" manual for version 7.0, to assign a packaged function to a segment in a specified order use the FUNCTIONS statement in the .DEF file as follows:
FUNCTIONS:<segmentname> <function> [<function>...]
(To create packaged functions, specify the /Gy option on the C/C++ compiler
command line.) When LINK processes a FUNCTIONS statement of this type and
the error above occurs, LINK creates an empty segment named <segmentname>.
Because the functions reside in a COMDAT record in the object file, LINK
creates a segment named comdat_seg1 in the executable file for the
functions.
According to page 601 of the "Environment and Tools" manual, the following statements place specified functions into a segment and place the segment into an overlay:
SEGMENTS <segmentname> OVL:<segmentnum>
FUNCTIONS:<segmentname> <function> [<function>...]
When LINK processes the SEGMENTS and FUNCTIONS statements and the error
above occurs, LINK creates an empty segment named <segmentname> and places
it into the specified overlay. However, the functions remain in the
resident portion of the application.
Additional reference words: 5.30 5.31.009 KBCategory: kbtool kbbuglist kbfixlist KBSubcategory: MoveOverlay
Keywords : kb16bitonly
Solution Type : kbfix
Last Reviewed: September 17, 1997