Mono: Write the MONO program directly using the MSIL instruction
This section talked about something that looks a bit underlying, using the ILASM writing program directly. At present, I feel that I have written programs directly in addition to displaying themselves, there is no other thing that can be showing off.
Or start a solution, here chooses the ILASM console project:
Figure 2.5.0
Monodevelop will help us generate a HelloWorld simple program:
Figure 2.5.1
.assembly helloworld // Defines the HelloWorld assembly
{
}
.namespace defaultNamespace // No namespace, use the default namespace
{
.class private auto ansi beforefieldinit mainclass // Define Class
{
.entrypoint
.MAXSTACK 1
LDSTR "Hello World!" // Press the address of the "Hello World!" string into the stack
Call void [mscorlib] system.console :: WriteLine (String) // Call the WriteLine (String) method for the msystem.console class in the Mscorlib assembly Display string
Ret // Return
}
}
This is the simplest ILASM program.
Press F8 to compile, execute the program under the console:
Figure 2.5.2