什么是组件对象模型(COM)?是否依赖语言? [英] What is the Component Object Model (COM)? Is it language-dependent?
问题描述
我是COM的新手,我不知道它是什么或为什么存在.
I'm new to COM, and I don't know what it is or why it exists.
这是像OOP这样的编程方法吗?编程语言是否必须支持它?(带有一些特殊的关键字或其他内容)
Is this a programming methodology like OOP? Do programming languages have to support it? (with some special keywords or something)
当我问我的教授时,他说:
When I asked my professor about it, he said:
COM是执行OOP的二进制稳定方式.我们需要知道二进制布局(something..something ..)
COM is a binary-stable way to do OOP. We need to know binary-layout (something..something..)
我不知道这意味着什么.有人说它用于代码重用.OOP已经在这方面做得很好,那么为什么这个COM首先要发展呢?
I've no idea what it means. Some people say it is used for code reuse. OOP does a good job at that already, so then why did this COM evolve in the first place?
C ++和COM是什么?无论我在哪里看到COM,总是使用抽象的C ++示例对其进行描述.它仅适用于C ++吗?
What is it with C++ and COM? Wherever I see COM, it's is always described with abstract C++ examples. Is it only for C++?
有人可以给我看个案例或例子,以便我了解对COM的需求吗?学习此课程有什么要求,以便我可以编写自己的组件?
Can any one show me a case or exmaple so that I can understand the need for COM? What are the requirements for learning this, so I can write my own components?
推荐答案
COM的核心是一种提供独立于任何特定语言的数据传递协定的方式.事实证明,它与语言无关,因为有许多支持COM的语言(有C ++,C,.NET和Java实现)
COM at its core is a way of providing a data-passing contract which is independent of any specific language. It is provably not language dependent, as there are many languages which support COM (there are C++, C, .NET, and Java implementations)
在实践中,它对于两个不同的示例很有用:
In practice it is useful for a couple of different examples:
- 不同语言之间的通信:由于COM与语言无关,因此可以使用COM在不同语言的组件之间传递数据.例如,您可以使用COM在C ++,Java和.NET代码之间进行对话.
- 线程语义:COM允许您为特定组件定义线程语义,以确保无论在何处使用它,都可以在适当的线程上下文中创建它.
- 常规组件化.
这篇关于什么是组件对象模型(COM)?是否依赖语言?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!