Microsoft KB Archive/92408

From BetaArchive Wiki
Knowledge Base


PSS ID Number: 92408

Article Last Modified on 6/12/2001



The information in this article applies to:

  • Microsoft Linker for MS-DOS and Windows 5.3



This article was previously published under Q92408

SYMPTOMS

When an application is compiled with Microsoft C version 6.0, it runs without any problems. However, when the application is rebuilt using Microsoft C/C++ version 7.0, the program hangs in the CTR0.ASM module while executing the following code:

   MOV  cx, __qczrinit        ;* Get initializer address
   JCXZ @f                    ;* Is it zero?
   CALL cx                    ;* No -- call indirect
                

CAUSE

There is a problem in the Microsoft Linker (LINK) version 5.3 that does not initialize data in the DGROUP segment to 0.

RESOLUTION

There are two methods resolve this problem:

  • Modify the CRT0DAT.ASM file to initialize _qczrinit. Change line 176 from the following:

    dw 1 dup (?)

    to the following:

    dw 0

    Assemble the CRT0DAT.ASM file. Then use the LIB utility to place the CRT0DAT.OBJ file into the C/C++ 7.0 library file. -or-

  • Obtain the C/C++ 7.0 patch release. This release contains LINK version 5.31.009 which correctly initialize variables in the DGROUP segment to 0.


STATUS

Microsoft has confirmed this to be a problem in LINK version 5.3. This problem was corrected in LINK version 5.31.009.

MORE INFORMATION

The C 6.0 startup code explicitly initializes _qczrinit to 0 when the variable is declared. The C/C++ 7.0 startup code does not initialize the symbol. Instead the code relies on the linker to perform the initialization automatically. There is a problem in the Microsoft Linker (LINK) version 5.3 that does not initialize data in the DGROUP segment to 0.

Because the _qczrinit value is not initialized, if the random data in the _qczrinit variable is not zero, the startup code calls the address to which the _qczrinit variable points. Calling a random address in this manner causes the system to hang.


Additional query words: 5.30

Keywords: kb16bitonly KB92408
Technology: kbAudDeveloper kbLINK530DOS kbLINKSearch kbVCsearch kbZNotKeyword6