asp net 3.5unleashed

Page 41

// Call the C runtime library’s printf function. printf("Displayed by printf.\r\n");

// Call the FCL’s S y s t e m . C o n s o l e ’ s W r i t e L i n e m e t h o d . Console::WriteLine("Displayed by Console::WriteLine."); }

Compiling this code couldn’t be easier. If this code were in a MgdCApp.cpp file, you’d compile it by executing the following line at the command prompt: cl /clr MgdCApp.cpp

The result is a MgdCApp.exe assembly file. If you run MgdCApp.exe, you’ll see the following output: C :\> M g d C A p p Displayed by printf. Displayed by Console::WriteLine.

If you use ILDasm.exe to examine this file, you’ll see the output shown in Figure 1-8.

Figure 1-8 : ILDasm showing MgdCApp.exe assembly’s metadata In Figure 1-8, you see that ILDasm shows all the global functions and global fields defined within the assembly. Obviously, the compiler has generated a lot of stuff automatically. If you double-click the Main method, ILDasm will show you the IL code:


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.