COM与非COM DLL [英] COM vs non-COM DLL

查看:183
本文介绍了COM与非COM DLL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的大部分经验是使用Java和VB.NET等高级语言。我有一些C ++(在大学)的经验。

The majority of my experience is with high level languages like Java and VB.NET. I do have some experience with C++ (at university).

我理解COM DLL和由.NET编译器生成的DLL之间的区别。我不完全理解COM DLL和由C和C ++编译器生成的Windows DLL之间的区别。

I understand the difference between a COM DLL and a DLL produced by a .NET compiler. I don't fully understand the difference between a COM DLL and a Windows DLL generated by the C and C++ compiler.

我想在.NET程序中使用C ++ DLL。我设法得到这个工作。我的问题是具体:C ++生成的DLL和VB6(基于COM)生成的DLL之间的区别。

I want to use C++ DLL in a .NET program. I have managed to get this working. My question is specifically: What is the difference between a DLL produced by C++ and a DLL produced by VB6 (COM based).

我花了一个小时Googling这和看在MSDN上。

I have spent an hour Googling this and looking on MSDN. I though I would find my answer without having to ask a question, but I have not.

推荐答案

有一个巨人两者之间的区别。该列表太长,无法在SO post中准确再现,我会尝试突出强调:

There's a giant difference between the two. The list is too long to reproduce accurately in an SO post, I'll try to hit the highlights:


  • 函数或类,它想要提供给客户端代码。 COM DLL仅导出具有众所周知名称和行为的4个函数。

  • 使用C ++ DLL的应用程序必须在链接时描述该DLL的接口,COM服务器在运行时绑定

  • 使用C ++ DLL的应用程序必须允许Windows在启动时查找DLL,通常是将DLL放在与EXE或路径相同的目录中。找到COM DLL时,客户端应用程序不指定它所在的位置。注册表在运行时用于定位DLL

  • COM服务器不一定是DLL。它可以是任何东西,包括在同一台机器上的独立进程或位于另一台机器上的可执行程序。客户端代码不知道它所在的位置

特定于COM的自动化子集:

Specific to the Automation subset of COM:


  • COM服务器可由任何支持COM的语言使用。

最后一个弹头可能是什么让你想起你认为你明白了什么之间的区别一个COM DLL和一个.NET DLL。它们没有什么共同之处,但.NET是相当不错,并与COM服务器互操作。 Tlbimp.exe实用程序非常熟练地记录了差异。

The last bullet is possibly what trips you up about thinking that you understand the difference between a COM dll and a .NET dll. They have nothing at all in common, but .NET is pretty good and inter-operating with COM servers. The Tlbimp.exe utility is quite adept at papering over the differences.

这篇关于COM与非COM DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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