(1) How is the object shared? |
Think of these distinct cases of calling a function.
1. The code is in a DLL.
You have to load the library, find the function's address, pass the parameters, make the call, pass the return values back.
2. The code is in another process.
You have to find the process, find the function you want call, send the parameters, execute the call, pass the return values back.
3. The code is in another process on another computer.
You have to find the computer, connect to it, then do all the stuff for scenario 2.
The COM interface is general enough (and complicated enough) to provide a single mechanism for doing all 3, the latter being called DCOM.
The object is accessed thru methods, only. So whether it's actually in process, or external, or remote is transparent. But, COM allows either.
(2) Is there arbitrary-OS libraries similar to COM? |
Yes. As I said earlier, CORBA.
Well, COM is Microsoft's baby. (Happily) no one else cares. CORBA was born on Unix and used in modern times in Java environments.
Both of these technologies are based on RPC (DEC's Remote Procedure Call). In the age of the internet, we can do better.
Have you ever wondered why Windows computers are always more highly specified (more memory, faster disks) than the equivalent Linux ones for doing the same job, even though ALL PC hardware is designed to run under Windows? Similarly, the equivalent Macs always have less memory for the same performance.