Including Common Intermediate Language to your .Net designer toolbox - the beginning
Include Common Intermediate Language to your .Net designer toolbox
Why?
See:
Abstraction stacks and multi-paradigm software design
https://blogs.msdn.com/marcod/archive/2004/02/19/76637.aspx
Simplistic program - straight start
Create a text file named uno.il
(“uno” has been the name of the very first program I have written for every programming language I have learned, uno means one in Spanish)
We want a .Net assembly, so start stating that:
.assembly uno {}
A .Net assembly contains interesting information known as metadata; also represent a logical group of .Net modules (separated files which contain actual CIL code), so we need at least one module containing our code:
.module uno.exe
This minimalist typical first program can be made of a single method that shows a string message on the screen, so state that with:
.method static void start()
As you see, individual methods can be used with CIL; the above line starts a method table in the assembly metadata, filled with:
Name of the method: start
Method arguments: none
Return type: void
Flag: static
There are many more entries in a metadata method table, which in out case get default values.
The grammar for a method definition is:
<method_def> ::=
.method <flags> <call_conv> <ret_type> <name>(<arg_list>) <impl>
{
<method_body>
}
Following with our method body, we type:
{
.entrypoint
To start the method body and to state that this method is the entry point for our assembly.
Now, CIL instructions for displaying a message on the screen, first we load the string message into the stack:
ldstr "here uno is executing"
then we make a method call to another assembly:
call void [mscorlib]System.Console::WriteLine(string)
to finish we state the end of our method and method body:
ret
}
That’s it, we have our first CIL source, the complete listing is:
.assembly uno {}
.module uno.exe
.method static void start()
{
.entrypoint
ldstr "here uno is executing"
call void [mscorlib]System.Console::WriteLine(string)
ret
}
at this point you could save and compile with the following command line:
ilasm uno.il
the last line of the displayed output should be:
Operation completed successfully
And there must be a file named uno.exe, execute it and enjoy that special feeling that brought you to this profession of programming.
Just as Mr. Churchill said: "This is not the end, this is not even the beginning of the end; perhaps this is the end of the beginning"
Comments
- Anonymous
March 27, 2004
some refs:
Word2003 RSS reader
http://www.ftponline.com/portals/microsoft/office/demos/gunderloy/
http://www.sharpreader.net
http://www.rssbandit.org
http://radio.userland.com
http://bloglines.com
http://subaverage.com/random/slashdot.rss
Sharepoint
http://blogs.msdn.com/kaevans/archive/2004/03/05/84822.aspx
Building a Desktop News Aggregator
http://msdn.microsoft.com/library/en-us/dnexxml/html/xml02172003.asp
http://www.ibm.com/developerworks/library/w-rss.html?ca=dnt-428
http://www.ibm.com/developerworks/news/dw_tech_nl.rss
http://msdn.microsoft.com/rss.xml
http://msdn.microsoft.com/vbasic/rss.xml
http://msdn.microsoft.com/vcsharp/rss.xml
http://msdn.microsoft.com/visualc/rss.xml
http://msdn.microsoft.com/netframework/rss.xml
http://msdn.microsoft.com/webservices/rss.xml
http://www.tbray.org/ongoing/When/200x/2003/04/22/RSS-Problems - Anonymous
June 07, 2004
see also:
http://www.devx.com/dotnet/Article/21268/