Working with dynamic link libraries (DLLs). Purposes of introducing DLLs


Glad to see you on my blog!

Found DLL files on your computer and have no idea what they are? I will share information with you. Without them, most programs and operating system generally will not be able to function. Want to know more? Don't miss my article.

Explanation

This abbreviation stands for “Dynamic Link Library”, and in our language - “dynamic link library” or more often as “dynamic link library”. It is installed by default on Windows OS, and previously also on IBM OS/2, until it ceased to exist. The library is intended for repeated use by various software.

The DLL contains important information: about the system configuration, device compatibility, commands for their correct operation etc. All this is stored in files of the same name extension or .drv for several system drivers, .cpl - for control panel files or in .ocx, if we are talking about libraries containing the ActiveX framework.

.dll objects contain code and data that can be used by multiple programs at the same time. Their contents are similar to the type EXE files. By the way, they even have the same format: Portable Executable (PE) for 32 and 64 bit Windows applications, and New Executable (NE) for 16-bit.

Many programs we install already have such files in their set. Otherwise, they use those that are in the operating system.

Dynamic libraries in practice

In theory, everything seems clear. But in order to understand the essence of the subject of our conversation, it is necessary to see it from the practical side. Without it, programs cannot work because they do not know how to do it.

Here's a basic example. To clean slate V Office Word The symbols you enter begin to appear, library components are needed, because the OS itself does not know what this or that key you press means.

Even when you just turn on the computer and have not yet had time to do anything, the library is already active: it showed you the time and date, opened programs in startup, built the desktop design, studied information about the operating system configuration, etc. In addition, how the system communicates with mouse, keyboard, printer and other equipment, also explains DLL.

Advantages of DLLs

What are dynamic libraries for? They were created in order to:

Hell for libraries

It was still not possible to fully realize the advantages described above. The fact is that the software may not completely require at the same time compatible versions libraries. Because of this, malfunctions occur in its operation. In addition, due to conflicts, the reliability of the OS as a whole decreases. This phenomenon is called “DLL hell” (if anyone doesn’t know, the last word is translated as “hell”).

How does the user see this?

Let's assume that you have never updated these libraries on your computer and installed a game that was released about 5 years ago. It works fine for you. Then you discovered that the latest part of the game had recently been released, and you installed it too.

However, the second one already refuses to start. She accompanied her disobedience with a message saying there was a DLL error, the file was missing. This means that the components on your computer necessary to run it do not work or are missing altogether.

This may be due to incorrect indication of the bit depth or system version during the game installation process or for other reasons. After all, programs and games can overwrite library files (see the last advantage), as a result of which this or that software sometimes refuses to work.

Solution

To prevent such situations from emerging, recent generations Windows introduced Side-by-side assembly technology. It allows for parallel use different versions libraries. True, this innovation goes against the principle of modularity, which was initially an advantage.

In cases where the system generates a DLL error, you can try downloading and installing updated individual components or the whole package. By the way, you can track which applications use which library files using special utilities, For example, Dependency Walker.

That's all.

If you find something unclear on the computer or just bored, come back. I always have useful articles;)

What are DLL files and what are they for? The abbreviation DLL stands for Dynamic Link Library. It is installed in all operating rooms Windows systems, and almost every program or game on a computer uses this library. It contains information about the system configuration, device compatibility, a set of commands for proper operation and much more. Some game files have ready-made libraries in their folders, others use system ones.

Why do we need DLL components?

In short: what are DLL files? - these are library components, and they are needed to run programs, applications and games. The computer has turned on and the system is working properly. You haven’t launched or opened anything yet, but dozens of DLL files are already in use. Simple clocks, system configuration information, program launch order, design, and much more use the library. In order to text document characters started appearing that match your input, you need a library. By default, the system does not know what the key you press means, DLL components help with this. The situation is similar with all connected devices: printer, mouse, keyboard, flash card. It is the DLL files that “tell” them how to work with your system parameters.

Element performance

It is important to update the system and library periodically; outdated files will cause the program to fail. For example, you installed games that are five years old or older, they work fine for you. Next, you installed a new part of the game, which is no more than a year old. It may not start for you. The system will display the following alert: DLL error, file missing. It means that the files are non-working or are not on the computer at all. This is due to the fact that programs or games that use the library can make changes. For example, you installed the game, but you specified the system bitness and OS version incorrectly.

The current files will be overwritten and the program will stop working. If the DLL is missing, it means that it needs to be downloaded and placed into the system manually. But in most cases, new games require new files that were not present at all in older system builds, and there is only one solution - install or update the entire package.

On our website, you can download both a separate DLL and the entire package, which will contain all the updated files. You can find a missing file either through a search or by the first letter in top menu. Read how to install a DLL file and register it in another article, where we described this process in as much detail as possible.

DLL is an abbreviation for Dynamic Link Library. A dynamic library of resources and routines allows you to reuse previously written modules. The library file may include, for example, procedures and icons. It is required for the operation of Windows operating systems.

In programming, a library is a collection of programs that can be accessed when developing software. A set of small programs is dynamically included in a larger one when called as component. The advantage of a DLL file is that it does not take up RAM, but is loaded if necessary during run-time, which allows you to significantly save RAM. A DLL program can work with devices: printer, scanner. When working with text in MS Word, there is no need for the constant presence of a DLL printer. If the document is printed, MS Word accesses the dynamic library and calls the corresponding DLL program for the printer.


A set of dynamic routines can be used simultaneously in several running programs - this is another plus. That is why they are also called “library” common use" The bottom line is that only one copy of the dynamic library is loaded into RAM, and all active computers access it. this moment programs. Which also leads to saving RAM resources. In addition to critically necessary routines, the DLL contains additional functions. They can be used as a plug-in, thereby increasing the functionality of the program. Absence the required module in a DLL makes it impossible for the main program to work. This is a negative quality of a dynamic library.


Dynamic library files have standard extension in each operating system: in OS/2 and MS Windows – “.dll”; Mac OS - ".dylib"; UNIX - ".so". Such files are stored in a specific location. For example, in "System32". When writing an application, the programmer specifies the name desired function and the name of the library in which it is located. The subroutine code itself is not written in the source text, which greatly simplifies the programming process. This principle is based on the previously popular modular coding. Simple programs designed as separate modules, which made it possible not to write them anew each time, but to include them in the code new program V finished form– compiled module.


Except executable code procedures and functions in a dynamic library you can store graphic and video files. Their use allows you to save not only RAM, but also disk space. The numerous advantages of the DLL library are not reduced by one drawback - loading modules requires Extra time. Their advantages are obvious, so they are widely used by programmers in almost every program.


Be very careful when working: never change the “.dll” extension to something else, do not transfer these files to another folder. Giving a file the suffix “.dll” will not change its type. Required for conversion special application. Most often, errors in Windows work are associated precisely with the lack the desired file".dll".

8 answers

What is a DLL?

Dynamic link libraries (DLLs) are similar to EXEs, but they are not directly executable. They are similar to .so files in Linux/Unix. In other words, DLL is an implementation of MS shared libraries.

DLL files are similar to EXE in that the file format itself is the same. Both EXE and DLL are based on the Portable Executable (PE) format. DLLs can also contain COM components and .NET libraries.

What does the DLL contain?

DLL contains functions, classes, variables, user interfaces and resources (such as icons, images, files,...) that the EXE or other library uses.

Library types:

In almost all operating systems there are 2 types of libraries. Static libraries and dynamic libraries. IN Windows extensions The files are as follows: Static libraries (.lib) and dynamic libraries (.dll). The main difference is that static libraries are linked to the executable at compile time; whereas dynamically linked libraries are not linked until runtime.

More information about static and dynamic libraries:

You usually don't see static libraries though on your computer because the static library is built directly inside a module (EXE or DLL). A dynamic library is a self-contained file.

The DLL can be changed at any time and is only loaded at runtime when the EXE explicitly loads the DLL. Static library cannot be changed after it is compiled into EXE. DLLs can be updated individually without updating the EXE itself.

The program loads the DLL when launched via the Win32 LoadLibrary API or when it is a dependency on another DLL. The program uses GetProcAddress to load a function or LoadResource to load a resource.

Further reading:

Related questions


Similar questions

What is a DLL?

DLL files are binary files, which can contain executable code and resources such as images, etc. Unlike applications, they cannot be executed directly, but the application loads them as needed (or immediately during startup).

How important are they?

Most applications load DLL files that they require when launched. If any of them are not found, the system will not be able to start the process at all.

DLL files may require other DLL files

Just as an application requires a DLL file, a DLL file can depend on other DLL files. If one of these DLL files is not found in the dependency chain, the application will not load. This is easily debugged using any dependency dependency tools such as Dependency Walker.

There are so many of them in system folders

Most of functionality systems presented user program as DLL files since they are the standard form sharing code/resources. Each functionality is stored separately in different DLL files so that only the required DLL files are loaded and hence reducing memory constraints on the system.

Installed applications also use DLL files

DLL files also become a form of separation of functions physically, as explained above. Good apps also try not to load DLL files until they are absolutely necessary, which will reduce memory requirements. This also causes applications to send a lot of DLL files.

DLL Hell

However, sometimes system updates often interrupt other programs when there is a version mismatch between the shared DLL files and the required program. System control points and cache DLL etc. There have been M$ initiatives to address this issue. The .NET framework may not encounter this problem at all.

How do we know what's inside a DLL file?

You should use an external tool like DUMPBIN or Dependency Walker, which will not only show what publicly visible functions (known as exports) are inside DLL files, but also what other DLL files it requires, and which exports from those DLL files, this DLL file depends on.

How do we create/use them?

Refer to documentation for software from your supplier. For C++, refer to LoadLibrary on MSDN.

Let's say you create an executable that uses some of the functions found in the library.

If the library you are using static, the linker will copy the object code for these functions directly from the library and paste them into the executable.

Now, if this executable is running, it has everything it needs, so the executable loader simply loads it into memory and runs it.

If the library dynamic, the linker will not insert object code, but rather insert a stub that basically says this function is in this DLL in this place.

Now, if this executable is running, bits of the executable are missing (like stubs), so the loader goes through the executable, fixing the missing stubs. Only after all stubs have been resolved will the executable be allowed to run.

To see this in action, remove or rename the DLL and watch the loader report the missing one DLL error when trying to run an executable file.

Therefore the name Dynamic link library,Parts of the linking process are performed dynamically ,at runtime by the executable loader.

One last note, if you don't link to the DLL then no stubs will be inserted by the linker, but Windows still provides the API GetProcAddress, which allows the execution of a DLL to be loaded after the executable has been launched.

DLL files contain Export table, which is a list of characters that can be viewed by the calling program. Symbols are usually functions with the C calling convention (__stcall). The export table also contains the address of the function.

With this information, the calling program can then call functions inside the DLL, even if it did not have access to the DLL at compile time.

DLLs (Dynamic Link Libraries) and SLs (UNIX-equivalent Shared Libraries) are simply executable code libraries that can be dynamically linked to the executable at boot time.

Static libraries are inserted into the executable at compile time and are committed from that point. They increase the size of the executable file and cannot be split.

Dynamic libraries have the following advantages:

1/They are loaded at runtime rather than compiled, so they can be updated independently of the executable (all those fancy windows and dialog boxes the ones you see on Windows come from a DLL, so appearance your application can be changed without rewriting it).

2/Since they are independent, the code can be divided into several executable files- this saves memory because if you are running 100 applications with one DLL, there may only be one copy of the DLL in memory.

Their main disadvantage is advantage #1 - changing the DLL independent of the application can cause your application to stop working or behave weirdly. DLL versions tend to not be managed very well under Windows, leading to the fancy name "DLL Hell".

Today I’ll tell you about a solution to a problem that users often encounter. Error due to missing file dlls. This error appears on your computer if it is missing from the system required file"dynamic libraries". These files are necessary for the operation of the program being launched, most often it is the game that gives you this error.

From Wikipedia:

DLL- “dynamic link library”, “dynamic link library”, in operating systems Microsoft Windows and IBM OS/2 - a dynamic library that allows reuse by various software applications. These libraries usually have a DLL extension. Just like EXEs, DLLs can contain sections of code, data, and resources.

Data files with the same format as a DLL, but with a different extension, or containing only a resource section, can be called resource DLLs. Examples include icon libraries, sometimes with the extension ICL, and font files with the extension FON and FOT.

Initially, it was assumed that the introduction of DLLs would allow efficient memory and disk space management, using only one instance of the library module for various applications. This was especially important for earlier versions Microsoft Windows with severe memory limitations.

Further it was planned to improve the efficiency of development and use system tools due to modularity. Replacing DLL programs from one version to another should have allowed the system to be expanded independently without affecting applications. In addition, dynamic libraries could be used by different types of applications - for example, Microsoft Office, Microsoft Visual Studio, etc.

Typically, the absence of this file on your computer is caused by two reasons:

  1. A required library was not installed.
  2. The required file was deleted by your computer's cleaning program, junk or not. necessary programs. These programs do not always remove only junk and unnecessary files.

I do not consider the human factor (actions committed out of ignorance, etc.)

Where can I get these libraries and files?

Typically, the operating system contains required libraries, latest versions, these files. But many programs use not only updated versions but also old. Sometimes, on the contrary, a program only needs new libraries, but the system has not been updated for a long time.

Have you thought that you just need to update the system? No, the solution to this problem is completely different.

We eliminate errors.

The missing files may be contained in two libraries.

Typically, if it's a game, you'll need to update or install the DirectX development kit.

If it's a program, it's usually missing Microsoft Visual C++ (MSVC) Integrated Development Environment files.

But sometimes it is necessary to install or update both components.

By updating both components, you will not only solve the existing problem but also prevent a return to this issue in the future.

For DirectX updates go to the developer's website and download the utility with which you can update your version of DirectX executable libraries.

WITH Microsoft update Visual C++ is getting more complicated. Microsoft Visual C++ contains several editions, and it is not known which edition the file you are missing is in.

You can download the required edition from the Microsoft website. But this is a more labor-intensive process; you need to download several versions of libraries.







2024 gtavrl.ru.