Library Support for Mixed Assemblies

Visual C++ supports the use of the C++ Standard Library, the C runtime library (CRT), ATL, and MFC for applications compiled with /clr (Common Language Runtime Compilation). This allows existing applications that use these libraries to use .NET Framework features as well.

Important

The /clr:pure and /clr:safe compiler options are deprecated in Visual Studio 2015 and unsupported in Visual Studio 2017.

This support includes the following DLL and import libraries:

  • Msvcmrt[d].lib if you compile with /clr. Mixed assemblies link to this import library.

This support provides several related benefits:

  • The CRT and C++ Standard Library are available to mixed code. The CRT and C++ Standard Library provided are not verifiable; ultimately, your calls are still routed to the same CRT and C++ Standard Library as you are using from native code.

  • Correct unified exception handling in mixed images.

  • Static initialization of C++ variables in mixed images.

  • Support for per-AppDomain and per-process variables in managed code.

  • Resolves the loader lock issues that applied to mixed DLLs compiled in Visual Studio 2003 and earlier.

In addition, this support presents the following limitations:

  • Only the CRT DLL model is supported for code compiled with /clr. There are no static CRT libraries that support /clr builds.

See also