Converting Projects from Mixed Mode to Pure Intermediate Language
All Visual C++ CLR projects link to the C run-time libraries by default. Consequently, these projects are classified as mixed-mode applications, because they combine native code with code that targets the common language runtime (managed code). When they are compiled, they are compiled into intermediate language (IL), also known as Microsoft intermediate language (MSIL).
To convert your mixed-mode application into pure intermediate language
Remove links to the C run-time libraries (CRT):
In the .cpp file defining the entry point of your application, change the entry point to Main(). Using Main() indicates that your project does not link to the CRT.
In Solution Explorer, right-click your project and select Properties on the shortcut menu to open the property pages for your application.
In the Advanced project property page for the Linker, select the Entry Point and then enter Main in this field.
For console applications, in the System project property page for the Linker, select the SubSystem field and change this to Console (/SUBSYSTEM:CONSOLE).
Note
You do not have to set this property for Windows Forms applications because the SubSystem field is set to Windows (/SUBSYSTEM:WINDOWS) by default.
In stdafx.h, comment out all the #include statements. For example, in console applications:
// #include <iostream> // #include <tchar.h>
-or-
For example, in Windows Forms applications:
// #include <stdlib.h> // #include <malloc.h> // #include <memory.h> // #include <tchar.h>
For Windows Forms applications, in Form1.cpp, comment out the #include statement that references windows.h. For example:
// #include <windows.h>
Add the following code to stdafx.h:
#ifndef __FLTUSED__ #define __FLTUSED__ extern "C" __declspec(selectany) int _fltused=1; #endif
Remove all unmanaged types:
Wherever appropriate, replace unmanaged types with references to structures from the System namespace. Common managed types are listed in the following table:
Structure
Description
Represents a Boolean value.
Represents an 8-bit unsigned integer.
Represents a Unicode character.
Represents an instant in time, typically expressed as a date and time of day.
Represents a decimal number.
Represents a double-precision floating-point number.
Represents a globally unique identifier (GUID).
Represents a 16-bit signed integer.
Represents a 32-bit signed integer.
Represents a 64-bit signed integer.
A platform-specific type that is used to represent a pointer or a handle.
Represents an 8-bit signed integer.
Represents a single-precision floating-point number.
Represents a time interval.
Represents a 16-bit unsigned integer.
Represents a 32-bit unsigned integer.
Represents a 64-bit unsigned integer.
A platform-specific type that is used to represent a pointer or a handle.
Indicates a method that does not return a value; that is, the method has the void return type.