What is COM?

Automation is based on the Component Object Model (COM). COM is a standard software architecture based on interfaces, and designed to have code separated into self-contained objects. Think of it as an extension of the Object Oriented Programming (OOP) paradigm, but applicable to separate applications. Each object exposes a set of interfaces, and all communication to an object, such as initialization, notifications, and data transfer, happens through these interfaces.
COM(组件对象模型)是一种以接口(interface)为基础的标准化软件体系结构,它是Automation技术的基础。一般认为,COM是面向对象编程(OOP)范式的发展,是一种可以跨越应用程序边界的技术。每个对象公开一组接口,与对象的所有通信,如初始化、消息、数据传输,都通过这组接口来完成。


COM is also a set of services provided by dynamic-link libraries (DLLs) installed with the operating system. Automation uses many of those services. One example is the "Marshalling" service, which packages the client application's calls to the member functions of the server application's interfaces and passes those, with their arguments, to the server application. It makes it appear that the server's interfaces are exposed in the client's memory space, which is not the case when the client is an .exe running in its own process space. Marshalling also gets the return values from the server's methods back across the process boundaries and safely into the hands of the client's call. There are many other services essential to Automation that are provided by the various COM libraries. Sources of information about those include "Inside Ole - Second Edition" by Kraig Brockschmidt, ISBN 1-55615-843-2, "Inside COM" by Dale Rogerson - ISBN 1-57231-349-8, and "Automation Programmer's Reference," ISBN 1-57231-584-9.

COM也是一组服务——由安装到操作系统的动态链接库(DLL)提供的一组服务。Automation大量使用这些服务,比如Marshalling服务。Marshalling服务的作用是将客户程序对服务程序接口方法的调用“打包”,然后通过操作系统提供的底层机制跨越进程边界乃至跨网路传输给服务器程序。在Marshalling机制的服务下,在客户程序看来,服务器的接口就在本进程的地址空间内,而在服务器看来,客户的调用也来自本进程的地址空间。实际上,当服务器与客户程序是各自独立的EXE文件时,它们的地址空间是互相独立的,是Marshalling服务的中介作用造成了这样的假象。自然,Marshalling服务也要负责把服务端方法的返回值传递给客户端程序。除Marshalling服务之外,还有大量Automation所依赖的COM服务。关于这些服务的描述,可参阅Kraig Brockschmidt写的"Inside Ole"(第二版),ISBN 1-55615-843-2,Dale Rogerson写的"Inside COM",ISBN 1-57231-349-8,"Automation Programmer's Reference",ISBN 1-57231-584-9。

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值