CLR的课程加载服务 [英] CLR's class loading services

查看:81
本文介绍了CLR的课程加载服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I read topic from google and I understand this:

    Windows loader loads the exe or dll of .net app.
    Then windows loader creates clr for that process.
    Then it locates entry point to application and call it.
    But before that class loader service of clr comes and loads the class containing Main method.
    And then jit compilation takes place.
    The clr provoids services like gc,exception handling,class loading etc to our app.

My questions are:

Now when we run .net app clr locates entry point and starts execution . But when it encounters

Class1 ob = new Class1();  

that time how our process calls the service of CLR called as class loader? MSIL code equivalent to is newobj internally calls to clr''s class loader service?

推荐答案

该过程如下所示:

1.特定语言代码被编译为MSIL程序集.

2.程序集以类似于Windows PE文件的方式,使程序集中的第一条指令始终加载CLR,该CLR负责编译相应程序集的其余内容.

现在是您的问题,其中您询问了CLR如何加载程序集中引用的类.为了理解这一点,您需要对点网程序集及其所包含的内容有更多的了解.装配总有两件事:

1.组装清单
2. MSIL代码

除许多其他事项外,程序清单清单部分还包含任何其他组件的所有引用(可能包含此MSIL中引用的类的MSIL代码)或任何其他资源,例如documentataion,dll引用了任何其他信息.因此,CLR查找该零件并相应地编译/执行相应的程序集.

我建议您深入了解点网程序集的内容,原因和方式.

问候
Pawan
The process works like this:

1. particular language code gets compiled to MSIL assembly/assemblies.

2. An assembly resembles the windows PE file in a way that the first instruction in the assembly always loads the CLR which takes over in terms of compiling the rest of the content of the corresponding assembly.

Now comes your question wherein you asked how does CLR loads the classes being referenced in the assembly. For this to understand you need to know little bit more on what is dot net assembly and what content it holds. An assembly always have two things:

1. Assembly manifest
2. MSIL code

Apart from many other things the assembly manifest part contains all the references of any other assebmlies (that might contain the MSIL code of classes that are referenced in this MSIL) or any other resources i.e., documentataion, dlls referenced any other information. So the CLR looks up this part and compiles/executes the corresponding assembly accordingly.

I''d recommend that you drill down on what, why and how of dot net assemblies.

Regards
Pawan


http: //www.tebyan.net/newindex.aspx?pid=31159&BookID=23914&PageIndex=23&Language=3 [

这篇关于CLR的课程加载服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆