Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Doubt in COM DLL and normal DLL.

Status
Not open for further replies.

isaisa

Programmer
May 14, 2002
97
IN
Hi All,
I am a beginner to COM. I was going throgh the COM book. i have some confusion in my mind. i understood that the component can be implemented as an out of process or in process servers. In case of COM implemented as DLL, the COM object uses client's address space.
So how it is different from normal DLL. Meaning if i am given normal DLL and one COM DLL, how do i differentiate looking at both of them ....

thanks in advance
sanjay

 
Why would you need to differentiate them?

The COM DLL:
- exports a DllRegisterServer and DllUnregisterServer methods which register your COM component into system registry (context associations if needed, path to library, server type (inprocess, out-of-process or out-of-machine (DCOM only)) and much more stuff. Check the MSDN ;)
- you can register the COM dll by issuing a command like "regsvr32 <your_module.dll>" in a console. Make sure that <your_module.dll> is in the current directory so that regsvr32 can load it (it basically calls DllRegisterServer). To unregister it issue something like "regsvr32 /u <your_module.dll>" with same considerations as for registration (unregistering means that regsvr32 calls DllUnregisterServer - hence the need that these two method exist and perform some specific actions).

Usually you do not have to manually implement the two methods, they are generated at compile time by means of MIDL (Microsoft Interface Definition Language).

Usually registering a server means more than calling DllRegisterServer: setting the registry so that the CLSID (Class ID) is associated with your module is one of very important thing; setting the security permission for COM objects; setting the COM server type; specifying the exposed interfaces; specifying the marshalling type and its interfaces and much more...

Check the MSDN for more infos.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top