"Take the horse

xiaoxiao2021-03-06  21

After reading the gold teacher, "Take the Human Flower ___ dynamic link technology overview" in the "9CBS Development Master" learned new content:

The source of the DLL is caused by the shared use of resource functions.

As a, b, two programs are used in the C function. If you write a C function separately in both programs, there is an increase in workload and increase the user's footprint, and it has also increased the latter maintenance. Complexity. Take our operating system, that is, the menu, if you write your own menu in your own program, the operating system will become a fat man, bloated and occupied resources.

So, a simple idea is generated, take it out separately, and then dynamically load it to A and B. There is a point, by using existing function libraries, writing programs have evolved into the following form:

(1) There is already a function in the call function library.

(2) Develop your own function,

(3) Fabricate these functions.

Then, here is to take it out and place it separately, then dynamically assemble when running in A, B, which is dynamic link. This compiled shared code file C is added to the D L (Dynamic Link Library: Dynamic Link Link Library) suffix name in W i N D O W s, which is C. DLL This is the DLL dynamic link library file we often say.

This triggers three problems:

1. We didn't call A and B, then loaded to the memory is not a waste of space?

2. We call A. It has been loaded with C. If you want to call B, then load C, the waste of space is still not resolved.

3. If A / B has been executed, C is still in memory, this ...

This has triggered the appearance of COM: COM is like a "universal glue", which will have a lot of DLL "sticking" into a whole with COM technology - this is Windows itself.

The history of COM:

Since then, you can dynamically create objects between different machines in the same network segment.

DCOM,

And integrate enterprise information system features such as MTS (Microsoft Processor) and MSMQ (Microsoft Message Queue)

COM ,

After the .NetFramework is released, Microsoft has not completely abandoned COM , but then wraps a layer on the basis of COM , so that

The .NET platform COM service is easier to use

An overview of dynamic link technology:

In the same code, in different processes may be mapped to different addresses, this process is done by the operating system, called dynamic link addresses. This is the basic principle of COM DLL operation.

COM Processes Server: The idea of ​​sharing code using the DLL file is expanded to using the EXE file, but also provides similar functions, but at this time, the code that needs to access the shared function must encapsulate your own request, then transfer it to Another process (ie the run EXE program), this EXE program is called the COM process server

Specific technology:

Non-MFC DLL

NON-MFC DLL): Do not use the MFC internally, which can be called by the MFC or non-MFC program, which uses a standard C interface output function.

Standard DLL

Regular DLL): Using the MFC internally, you can be called by the MFC or non-MFC program, which uses a standard C interface to output a function.

MFC extension DLL

MFC Extension DLL): Generally used to output new classes derived from the MFC class, only the MFC program can use this DLL. This actually applies an object-oriented idea to a try to have a try. Registered ActiveX DLL caused by DLL Hell:

1.a, b uses different versions of the DLL, due to the order of installation, only the last program installed DLL, if the compatibility is problematic, there is an unpredictable consequence

2. When deleting the program, I don't know how many programs are using the same DLL. If you delete it, you will not use some programs.

Since DLL Hell makess more and more DLL garbage in the system, the resources are occupied, affecting the speed of the system

This is the deficiencies of COM itself (need to register, and the position cannot be moved), which causes it inevitable to exit the historical stage.

Small information: COM interface and COM logo

The interface is a logical grouping of the C O M component function, and the outside world is obtained.

Take a specific interface pointer to use the functions provided by the component. Interface declaration

A set of functions, access to a component can only pass the interface functions

carry out.

The interface to access the C O M component must have the support of the C O M library,

The COM library is provided by the Windows operating system itself, and it is characterized by a set of Windows.

A P i function, mainly completing the creation, call, and destruction of C O M components, etc.

basic skills.

The COM component is identified by GUID (GlobalLoBally Identifier), one

A g u i d value accounted for 1 6 bytes, which is based on NICs on the computer.

Address or use some special algorithm to ensure the only one in the world

Sex. This algorithm is derived from the distributed meter of the Open Software Foundation (O S F)

The environment (D C e) is a set of standards for distributed computing.

Below is an example of g u i d:

AE6105F0-4EB6-43C9-A0DA-4E2BB6EBEF6

Note: G u i d is also called U U I D, which is a unique identifier.

According to the purpose, it is divided into the following G u I d:

1) G u i d for identifying component libraries is called L i b i d;

2) G u I D used to identify the component is called the class identifier C L S i D;

3) G u i D used to identify the interface is called I I d;

4) P R o g i d is a friendlyly user-specified programmer to a CLSID

Name, VB uses P R O G i D to identify C O M components, and its determination method is:

PROGID = ActiveX DLL engineering name. Class module name

The development of dynamic link technology in .NET:

1. Under .NET, all objects reference count maintenance and destruction are responsible for .NET Framework

2..NET Framework is a platform for a comprehensive object, developing a DLL library on this platform, which can be developed using all OO tools and methods.

Under the 3..NET, the meaning of the DLL file also has a fundamental change __assembly (domestic translation as an assembly or assembly accessory), it is just a virtual concept, not a real file

. N e t, the instruction code in the DLL is compiled as a Microsoft Intermediate Language (MSIL) instead of the target machine code.

The structure of Assembly is self-destruction, decides that it does not need to register, there are two points:

1. The DLL file is not related to the specific path when the dynamic link

2. DLL components self-instruction feature, also leads to an extremely powerful object creation mechanism ____ reflection (reflection)! 3. Can distribute and transfer objects in the network ___.net remote

转载请注明原文地址:https://www.9cbs.com/read-68176.html

New Post(0)