Presentation is loading. Please wait.

Presentation is loading. Please wait.

Microsoft’s Distributed Component Object Model (DCOM)

Similar presentations


Presentation on theme: "Microsoft’s Distributed Component Object Model (DCOM)"— Presentation transcript:

1 Microsoft’s Distributed Component Object Model (DCOM)
A semi-technical overview Jim Ries Updated 10/5/1999

2 Genealogy DCOM comes from COM and OSF (now Open Group) DCE
Remote Procedure Calls (RPC) Interface Definition Language (IDL) Component Object Model (COM) ORPC OMG CORBA - a parallel standard Different RPC Different IDL COM proxy == CORBA stub COM stub == CORBA skeleton

3 Microsoft proprietary, but . . .
Open Group’s COMSource: Software AG’s EntireX: The Active Group:

4 COM Goals Encapsulation (separate implementation from interface)
Versioning Execution context independence Language independence Object Creation / Lifetime Control Standard error code (HRESULT) Solve object discovery problem Scripting The Holy Grail of Reuse

5 Alphabet soup: COM/OLE/ActiveX
COM is a binary standard and a style for creating objects. OLE is (was) a set of COM interfaces for embedding documents (originally “Object Linking and Embedding”). ActiveX is a marketing buzz-word meaning COM and/or OLE, but usually applied to Internet-oriented components.

6 Later and later binding
“Editor inheritance” binds at compile time. Link libraries (.LIB) bind to “components” at link time. Dynamic link libraries (.DLL) bind at run time, but need a header at compile time, and path at runtime. COM components bind at runtime and may need neither a header, nor a path! (though typelib contains header-like “meta-data”)

7 Interfaces COM enforces the concept of interfaces being separate from implementation. Interface == Abstract Base Class Objects support multiple interfaces through multiple inheritance. Interfaces NEVER change! A “control” is just a COM component with the right interfaces.

8 GUID’s (or UUID’s) Globally Unique Identifiers (Universally Unique Identifiers) Needed to avoid name collisions A class is associated with a GUID (CLSID). An interface is associated with a GUID (IID). The Windows Registry: a hierarchical database.

9 Execution Context In proc - DLL’s (no marshalling)
Out of proc - EXE’s (LRPC) Remote - EXE’s using DCOM RPC DCE “compatible” (see “Interconnecting Personal Computers with the Distributed Computing Environment” by Jim Ries, UMC Thesis, 1998.)

10 Coding Tools C - Raw C++ - Raw C++ - ATL C++ - MFC Visual Basic
J++ (pseudo Java) Binary standard ==> any language COULD produce COM components.

11 Platforms Win32 Unix platforms (with some help)
Windows 95 (DCOM as separate download; included in OSR2) Windows NT 4.0 Windows 98 Windows 2000 Unix platforms (with some help)

12 Nuts and Bolts CoInitialize() CoCreateInstance() IUnknown
QueryInterface() AddRef() Release() CoUninitialize()

13 Demonstration - IDL [ object,
uuid(75D873CD-7B63-11D3-9D43-00C0F031CDDE), helpstring("IServer Interface"), pointer_default(unique) ] interface IServer : IUnknown { HRESULT Hello([in, string] char * pszMessage); };

14 Demonstration - Server Code
// Prototype class CServer : public IServer, public CComObjectRoot, public CComCoClass<CServer,&CLSID_Server> { // Some code omitted for brevity // IServer public: HRESULT STDMETHODCALLTYPE Hello(unsigned char * pszMessage); }; // Code HRESULT STDMETHODCALLTYPE CServer::Hello(unsigned char * pszMessage) char szBuf[256]; wsprintf(szBuf,"%s",pszMessage); ::MessageBox(0,szBuf,"Server",MB_OK); return(S_OK); }

15 Demonstration - Client Code
if (SUCCEEDED( hr=CoCreateInstance(CLSID_Server,NULL, CLSCTX_LOCAL_SERVER, IID_IServer,(void **)&pServer))) { if (SUCCEEDED(hr=pServer->Hello((unsigned char *)"Hello from the client"))) MessageBox("Client: Server printed the message"); else wsprintf(szBuffer,"Hello() method failed: 0x%lX.\n",hr); MessageBox(szBuffer); } pServer->Release(); wsprintf(szBuffer,"Unable to create a server: 0x%lX.\n",hr);

16 Distributed Scenario From “DCOM Architecture” a Microsoft white paper.

17 Demonstration Run DCOM “Hello world” demo here.

18 Additional Technologies
COM+ MTS - Microsoft Transaction Server MSMQ - Microsoft Message Queue Compiler supported IUnknown, etc. ADS - Active Directory Service As “distributed registry” As namespace abstraction All Microsoft products are COM based: IIS - Internet Information Server Exchange Internet Explorer Word, Excel, etc.

19 References Microsoft DCOM page IETF DCOM Standard Proposal
Inside OLE by Kraig Brockschmidt, Microsoft Press, 1995. Essential COM by Don Box, Addison Wesley, 1998. Inside COM by Dale Rogerson, Microsoft Press, 1997. Don Box homepage ActiveX COM Control Programming by Sing Li and Panos Economopoulos, Wrox Press, 1997. COM-CORBA Interoperability by Geraghty, et. al., Prentice Hall, 1999. Microsoft Developer Network


Download ppt "Microsoft’s Distributed Component Object Model (DCOM)"

Similar presentations


Ads by Google