什么是COM? [英] What is COM?

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

问题描述

我进行了艰苦的搜索,但无法掌握整个想法。谁能告诉我:

I searched hard, but was unable to grasp the whole idea. Can anyone tell me:


  • 什么是COM?

  • GUID如何工作,COM如何使用它们?

  • COM如何解决不同DLL版本的问题。

或者至少让我指向一篇不错的文章来解释这些概念?
谢谢!

Or at least, point me to a good article somewhere that explains these concepts? Thanks!

推荐答案

COM是组件对象模型。它是旨在允许组件二进制重用的首批技术之一……最初,它是对大约在1988-1992年的Microsoft Office中称为动态数据交换(DDE)的内容的重写。一种旨在允许各种Office应用程序相互通信的技术。重写它的第一次尝试是OLE自动化(对象链接和嵌入)。但是当他们完成后,他们将其重命名为COM。

COM is "Component Object Model". It is one of the first technologies designed to allow "binary reuse" of components... Originally, it was the rewrite of what was, in Microsoft Office circa 1988-1992 time frame, referred to as Dynamic Data Exchange (DDE), a technology designed to allow the various Office applications to talk to one another. The first attempt to rewrite it was called OLE-Automation (Object Linking and Embedding). But when they got done they renamed it to COM.

工作原理

本质上是在COM之前,当客户端组件想要使用组件时(编写作为C ++库),则必须使用该库进行编译,因此它可以确切知道已编译的二进制文件中有多少字节才能找到每个方法或函数调用。

Essentially, before COM, when a client component wanted to use a component (written as a C++ library), it had to be compiled WITH the library, so it could know exactly how many bytes into the compiled binary file to find each method or function call.

使用COM,就如何构造这些方法有一个定义的机制,然后编译器生成一个单独的文件(称为类型库或接口定义语言) (IDL)文件,其中包含所有这些函数偏移数据。

With COM, there is a defined mechanism as to how these methods will be structured, and then the compiler produces a separate file (called a type library or an Interface Definition Language (IDL) file, that contains all this function offset data.

然后,作为组件的用户,您必须注册该组件,该组件将写入所有这些信息。 (从GUID键入)进入OS注册表,任何客户端应用程序都可以在其中访问它,并且通过从注册表中读取数据,它可以知道二进制文件中的位置以找到每个方法或类入口点。

Then, as a user of the component, you have to "register" it, which writes all this information (Keyed off of GUIDs) into the OS Registry, where any client app can access it, and by reading the data from the registry, it can know where in the binary file to find each method or class entry point.

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

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