JavaScript EditorDhtml editor     Free javascript download 



Main Page

In Visual C++ .NET and Visual C++ 2003, DLLs compiled with the /clr compiler option could non-deterministically deadlock when loaded. This problem is often called the loader lock issue, and is described in detail in Initialization of Mixed Assemblies.

To address this problem, _vcclrit.h was provided in Visual C++ 2003 to help initialize DLLs in a manner that avoided loader lock. For Visual C++ 2005, initialization is handled in a completely different manner in order to dramatically reduce the chances of deadlock, so this header file is no longer required.

For backward compatibility, _vcclrit.h is still included, and code that uses it continues to work, but the contents of _vcclrit.h have been deprecated. This topic contains the recommended modifications required to remove dependency on this header file.

NoteNote

Although not an ideal solution, the deprecation warnings that result from using _vcclrit.h can be suppressed by defining _CRT_VCCLRIT_NO_DEPRECATE prior to including _vcclrit.h.

Linker Setting Changes

The following are changes that should be made to remove _vcclrit.h from projects that employed the recommended Visual C++ 2003 loader lock solution. They all involve changes to the linker settings. See Modifying Project Settings for instructions on changing these settings through Visual Studio.

  • Remove the /NOENTRY linker switch. Using _vcclrit.h required that the /NOENTRY (No Entry Point) switch be provided to the linker. This is no longer necessary.

  • Do not explicitly input MSVCRT.LIB to the linker. Because the /NOENTRY switch was required, it was necessary to explicitly link to the CRT library file MSVCRT.LIB. With /NOENTRY removed, this library is linked in by default under /clr compilation.

  • Remove of NOCHKCLR.OBJ from linker input. This file is no longer required.

  • Remove Forced Symbol References. Previously, it was necessary to force the following symbols with the /INCLUDE switch: __DllMainCRTStartup@12, __crt_dll_initialize, and __crt_dll_terminate. None of these symbols are necessary in Visual C++ 2005, so they can safely be removed.

Code Changes

Other than removing #include <_vcclrit.h> from your code, some additional changes may be necessary depending on the nature of your code. At the minimum, __crt_dll_initialize and __crt_dll_terminate will simply no longer be invoked, and can therefore be removed.

See Also



JavaScript EditorDhtml editor     Free javascript download