What is the Component Object Model (COM)? Is it language-dependent?

后端 未结 4 1934
灰色年华
灰色年华 2021-01-30 18:45

I\'m new to COM, and I don\'t know what it is or why it exists.

Is this a programming methodology like OOP? Do programming languages have to support it? (with some speci

4条回答
  •  终归单人心
    2021-01-30 19:21

    COM was first created as a mechanism to allow Microsoft Office applications to communicate with one another, then, in its second iteration it was modified and extended to become a specification for how binary code components could--if they were constructed according to the specification-- communicate with each other, and share data, no matter what language or OS they were built upon (as long as the binary file (the compiled .dll or .exe) conformed to the COM specification).

    The purpose was to allow "binary reuse" which means that a code component could be reused by multiple client code components, that the original code component knew nothing about, and which were not even in existence when the component was originally compiled. To quote from one of the original architects of COM, Don Box:

    [...] The design paradigm of COM was that component contracts are expressed as type definitions. This was a step forward from the world COM replaced, in which contracts were expressed only as simple functional entry points.In this respect, COM was a major advance because it brought the dynamic loading of code and the type system together in a fairly consistent manner.

提交回复
热议问题