除了扩展名之外,COM DLL 和 .NET DLL 之间是否有任何相似之处?
我最近几年才开始学习编程,而且都是用C#.NET。我知道 DLL 文件在 .NET 之前就已经存在,所以我想知道我现在创建的 .NET DLL 文件和以前存在的 COM DLL 文件之间是否有相似之处?换句话说,如果我将今天创建的 .NET DLL 提供给 COM 开发人员,他们是否能够从该文件中获取任何信息?或者它看起来像是一个带有他们熟悉的扩展名的乱码文件?
更新
感谢您迄今为止的回复。那么 EXE 文件呢? .NET EXE 和 COM EXE 之间有什么相似之处吗?未安装 .NET 的计算机是否能够找到 .NET exe 的入口点,还是只是认为该文件已损坏或无效?
I've only started to learn programing recently in the past couple years, and all of it has been in C#.NET. I know DLL files existed before .NET so what I'd like to know is if there is any similarity between the .NET DLL files I create now and the COM DLL files that existed before? In other words if I were to take a .NET DLL I created today back in time before .NET and give it to a COM developer would they be able to derive any information from the file? Or would it just look like a gibberish file with an extension they are familiar with?
Update
Thanks for the responses so far. Now what about EXE files? Are there any similarities between a .NET EXE and a COM EXE? Would a computer with out .NET installed even be able to find the entry point for a .NET exe or would it simply think the file is corrupt or invalid?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
相似之处以及因此重复使用相同扩展的原因在于它们在功能上是等效的。也就是说,它们都是包含潜在共享方法和类的类库。
但是,除非 .NET dll 对 COM 可见,否则 COM 开发人员将无法从中获取任何有用的信息。
编辑:
根据您的更新,一台没有安装 .Net 的计算机(甚至没有所需版本的 .Net 框架)将能够找到应用程序的入口点,但它会失败很快就会出现异常(即在它真正执行任何操作之前)。
The similarity, and hence the reuse of the same extension, is that they are functionally equivalent. That is, they are both class libraries that contain potentially shared methods and classes.
However, unless the .NET dll is COM-visible, then no, a COM developer would not be able to any useful information from them.
EDIT:
Per your update, a machine without .Net installed (or even one without the required version of the .Net framework), would be able to find the entry point for the application, but it would fail with an exception quickly (that is, before it really does anything).
没有任何对应关系。 .NET 程序集是一个数据文件,它包含 5 个字节的机器代码。剩下的就是元数据和 IL。如果没有工具反编译它,比如 ildasm.exe 或 Reflector,就已经够乱了。
There is no correspondence whatsoever. A .NET assembly is a data file, it contains 5 bytes of machine code. The rest is metadata and IL. Gibberish enough without the tools to decompile it, like ildasm.exe or Reflector.