开发者

How does the system determine whether a given DLL is a .NET DLL?

How does the system determine whether a given DLL is a .NET DLL or a Win3开发者_C百科2 DLL?


DLL and Exe files on Windows conform to the Portable Executable (PE) file format (see here for details).

.Net meta data is stored in the PE file in the CLR Data section.

If the PE file has a CLR Data section then the DLL or Exe is a .Net Assembly. If it doesn't then, AFAIK, it isn't.

See here for more details on the PE file format.


System has nothing really to do with it. It's the code that uses it has to know what to do. If you're writing a .NET app and you want to add a dll then if it is .net then simply CLR knows what to do (single instruction in IL). If it's not then you have to do sth with it eg. declare functions that come from that library. This is strictly compile time decision.


Have a read on .Net Assemblies. The easiest way is to look for Assembly Metadata. .Net Assemblies have IL code, so they are not at all similar to normal libraries which contain binary code.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜