none
What is the need for Compilers to read Metadata from managed module ? RRS feed

  • Question

  • Hi,

    I was going through CLR's execution model chapter from "CLR via C#".In one column of uases of Metadata it is given that :

    "Metadata removes the need for header and library files when compiling because all the information about the referenced types/members is contained in the file that has the IL that implements the type/members. Compilers can read Metadata directly from managed module."

    Since compilers are producing Metadata then why the compiler itself is reading the Metadata ? Why the compiler needed to read the Metadata ?

     


    Thanks.
    Monday, December 27, 2010 9:33 AM

Answers

  • The compilers reads metadata for existing assemblies like "mscorlib.dll" and uses the metadata to ensure that what you are trying to compile can use those assemblies.

    regards


    Espen Harlinn
    Monday, December 27, 2010 2:51 PM

All replies

  • The compilers reads metadata for existing assemblies like "mscorlib.dll" and uses the metadata to ensure that what you are trying to compile can use those assemblies.

    regards


    Espen Harlinn
    Monday, December 27, 2010 2:51 PM
  • Is there any difference in working mechanism  if in first case only referencing to Assembly is done and in another case referencing plus import of Namespace is done in cs files ?

    Will in both cases compiler will scan whole Metadata (of referenced Assembly) in one go ?


    Thanks.
    Monday, December 27, 2010 3:25 PM
  • Hi, I'm not entirely sure where you are going with this.

    To get a notion about the scope of the work required to implement a "real" .Net compiler - and the .Net platform in general you could take a look at the mono project: http://ftp.novell.com/pub/mono/sources-stable/

    This is pretty huge, but it's a great source of information. If you are seriously considering writing a compiler for .Net, the internals of a working compiler should prove invaluable.

    Microsoft has made a lot of the source code for the .Net runtime available at: http://referencesource.microsoft.com/netframework.aspx

    You may also want to take a look at http://www.charlespetzold.com/dotnet/index.html - a free book on .Net by Charles Petzold and "Programming .NET Components" by Juval Lowy (http://oreilly.com/catalog/9780596003470) - Juvals book is from 2003, but it's in - my opinion - one of the better introductions to general .Net development

    regards 


    Espen Harlinn
    Monday, December 27, 2010 4:39 PM
  • Based on your postings, this isn't something you have done before - taking a close look at something that does something that actually works and is otherwise similar to what you are trying to do, allows you to get some notion of the scope of the work you are looking at here.

    Regards

     


    Espen Harlinn
    Thursday, December 30, 2010 12:02 PM