The differences between COM and DLL and COMDLL

Source: Internet
Author: User

The differences between COM and DLL and COMDLL

Com is the Component Object Model (Component Object Model), which is the standard for Microsoft production software components.
It is a specification for building Binary compatible software components, regardless of the language of the component application, as long as the com specification can be followed.
Communicate with each other directly. The com specification is proposed to meet the following requirements:
1. Rapid program development: a large project can be divided into multiple com components for simultaneous development.
2. You can dynamically insert or uninstall com components.
3. You can hide or encapsulate the implementation details inside the com component.
Com components can be written in different languages, but communication between com components is achieved through component interfaces,
The implementation of the com Component Interface is unified, and it adopts the form of virtual function table (VTBL. The virtual function table contains
A group of pointers to component functions,We can use this set of pointers to obtain the memory address of the component functions we want to communicate.
Dll (Dynamic Link Library) is a set of modules that contain functions and data. It can export data or function
Other dll calls. Dll loading can be done through static link and dynamic link.
1. Compile the dll module to be linked to another module in binary format during static link.
2. Dynamic Link refers to calling the module to load DLL at runtime, using LoadLibrary function or LoadLibraryEx
The function loads the dll to the address space of the Process and calls the GetProcAddress function to obtain the exported DLL.
The address of the function.
Advantages of dynamic dll loading:
1. DLL can save memory and reduce swap. By sharing a single copy of the DLL in the memory, multiple processes can simultaneously
Use a DLL. In contrast, Windows requires
Load a copy of the library code for it in the memory.
2. DLL can save disk space. Multiple applications can share one DLL copy on the disk. In contrast,
Every application built using a static Link Library requires the library code linked to the program file image as
A separate private copy.
The relationship between dll and com: com is a specification. dll implemented according to the com specification can be considered as a com component,
For example, the interface encapsulation in the Active X control project created using mfc is described by idl, so it can be regarded
Com component. In addition, from the preceding descriptions of com and dll, we can see that the interfaces of com components are a group of APIs with specific specifications.
So the com component can be regarded as a dll, but the dll is not necessarily a com component.
The biggest difference between com and DLL is that dll is called in the way of function sets related to programming languages.Required for image VC
In addition, extern "C"... and COM is provided to users in interface mode, which is a binary call.
The specification is unrelated to the programming language. It uses the idl Interface Definition Language to describe itself to use class inheritance to implement its own functions.
And method. DLL only has one DLL situation, which can define any function is not limited, can only run on the local machine and COM
There are two situations: DLL and EXE: The DLL where COM is located must export four functions:
dllgetobjectclass, dllregisterserver, dllunregisterserver,
dllunloadnow
These four functions have their own functions, some of which are provided for the COM manager, used through CLSID and IID, and some are provided
For the Registry.
COM, combined with MTS, is the advanced version of COM +. It provides a more powerful and Secure Distributed COM Service,
DCOM runs on different machines and uses proxy and stub to realize local ing of remote interfaces.
The two are almost identical, but the startup speed of DLL is faster than that of COM!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.