Microsoft KB Archive/192536

= BUG: Msvcrt.dll Does Not Initialize Global Objects =

Article ID: 192536

Article Last Modified on 11/18/2003

-

APPLIES TO


 * Microsoft Windows CE Toolkit for Visual C++ 6.0
 * Microsoft Windows CE Embedded Toolkit for Visual C++ 5.0
 * Microsoft Windows CE Platform Builder 2.11

-



This article was previously published under Q192536



SYMPTOMS
When targeting Windows CE 2.00 and linking with C run-time dynamic libraries (Msvcrt.dll or Msvcrtd.dll), global C++ objects are not initialized.



RESOLUTION
If C++ global objects are being used, do not use the C run-time dynamic libraries. Use the static run-time libraries instead.



STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.



MORE INFORMATION
The C run-time dynamic libraries were available only with Windows CE version 2.0. Devices using Windows CE version 1.0 or Windows CE 2.01 and later should not use these libraries. The following program demonstrates the problem when linked with Msvcrt or Msvcrtd: // Sample.cpp - //   // Should show the constructor message before the main program // message. Instead, the constructor message isn't shown at all. //

#include 

#define MSG(z) MessageBox(0,z,TEXT("Sample"),MB_OK)

struct MYCLASS {     MYCLASS   { MSG(TEXT("Constructor called.")); } };

MYCLASS myclass;

int WINAPI WinMain(

HINSTANCE  hInstance, HINSTANCE  hPrevInstance, LPTSTR     lpCmdLine, int        nCmdShow)   {      MSG(TEXT("Main program."));      return 0;   }

Keywords: kbbug kbpending KB192536

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.