Is there an equivalent to COM on *nix systems ? If not, what was the *nix approach to re-usability?

前端 未结 3 1637
[愿得一人]
[愿得一人] 2020-12-07 17:39

I have an understanding of windows COM and the ideas behind it. I am trying to understand if *nix systems even have an equivalent or why they don\'t?

3条回答
  •  天命终不由人
    2020-12-07 18:17

    The closest would probably be D-Bus. D-Bus is a lightweight IPC protocol and Object Request Broker (ORB) very similar to COM and heavily inspired by both COM and D-Bus's predecessors DCOP (KDE) and CORBA (GNOME) as well as Netlink (Linux Kernel).

    Before D-Bus, both major Unix desktop environments had their own component models and desktop busses. GNOME had Bonobo which was based on CORBA and KDE had KParts which was based on DCOP. And the Linux Kernel has Netlink which is a communication protocol between kernel and userspace which is used for example by the iproute2 tool whenever you configure a networking interface.

    The kernel developers constantly got requests to release Netlink as a separate part for communication between userspace programs, however they feared that this would lead to feature bloat and maintenance problems. In the end, under the umbrella of the Free Desktop organization whose goal it is to create cros-desktop standards, both the KDE and GNOME developers got together to develop an IPC messaging system based on the best parts of DCOP and Netlink, and the result was D-Bus.

    In current versions of both GNOME and KDE, D-Bus has completely replaced CORBA and DCOP, thus making it possible to run GNOME applications in KDE and vice-versa with much higher fidelity. D-Bus has also been picked up by many other desktop environments and applications, not only on Linux but other Unix systems, as well as OSX and even Windows.

    An alternative that should at least be mentioned is Mozilla's XPCOM, which is a cross-platform object model heavily inspired by CORBA and COM. (In fact, XPCOM is an acronym for Cross-Platform Component Object Model.) It uses an IDL very similar to CORBA called XPIDL. However, as far as I know, nobody actually uses XPCOM, it is recognized both by critics as well as developers of Firefox and other Mozilla applications as one major source of bloat, and the Mozila developers are in fact actively working on reducing the usage of XPCOM especially inside components like Gecko.

    However, as @Daniel Pryden points out, there's a lot of stuff already in Unix that should be preferred over D-Bus in cases where tight integration with a desktop is not needed. I am talking about stuff like pipes, named pipes and sockets.

提交回复
热议问题