Mixed assemblies are capable of containing both unmanaged machine instructions and MSIL instructions. This allows them to call and be called by .NET components, while retaining compatibility with components that are entirely unmanaged. Using mixed assemblies, developers can author applications using a mixture of managed and unmanaged functionality. This makes mixed assemblies ideal for migrating existing C++ applications to the .NET Platform.
For example, an existing application consisting entirely of unmanaged functions can be brought to the .NET platform by recompiling just one module with the /clr compiler switch. This module is then able to use .NET features, but remains compatible with the remainder of the application. In this way, an application can be converted to the .NET platform in a gradual, piece-by-piece fashion. It is even possible to decide between managed and unmanaged compilation on a function-by-function basis within the same file (see ).
Visual C++ 2005 supports the generation of three distinct types of managed assemblies: mixed, pure, and verifiable. The latter two are discussed in Pure and Verifiable Code.
In This Section
- How To: Migrate to /clr
Describes the recommended steps for either introducing or upgrading .NET functionality in your application.
- How to: Compile MFC and ATL Code with /clr
Discusses how to compile existing MFC and ATL programs to target the Common Language Runtime.
- Initialization of Mixed Assemblies
Describes the "loader lock" problem and solutions.
- How To: Remove Dependency on _vcclrit.h
Describes how to revert the loader lock solution recommended for Visual C++ 2003.
- Library Support for Mixed Assemblies
Discusses how to use native libraries in /clr compilations.
- Performance Considerations for Interop (C++)
Describes the performance implications of mixed assemblies and data marshaling.
- Application Domains and Visual C++
Discusses Visual C++ support for application domains.
- Double Thunking (C++)
Discusses the performance implications of a native entry point for a managed function.
- Avoiding Exceptions on CLR Shutdown When Consuming COM Objects Built with /clr
Discusses how to ensure proper shutdown of a managed application that consumes a COM object compiled with /clr.
- How to: Create a Partially Trusted Application by Removing Dependency on msvcm80.dll
Discusses how to create a partially trusted Common Language Runtime application using Visual C++ by removing dependency on msvcm80.dll.
For more information about coding guidelines for mixed assemblies, see the MSDN article "An Overview of Managed/Unmanaged Code Interoperability" at