Home c++ What do you treat .lib and .dll?

What do you treat .lib and .dll?

Author

Date

Category

Hello.
Files (for connecting functions from libraries and packages. In C++) with the .lib and .dll extensions do not already know in the standard C++ library?


Answer 1, Authority 100%

First, let’s decompose the concepts on the shelves.

.lib format is the received MSVC (possibly and other compilers) Format Static Library , that is, the library that will be compiled by the linker in the executable module. Other compilers (especially – on other systems!) There may be another format of static libraries.

.dll format is a system-wide system-wide system-wide format dynamic libraries , that is, libraries that are connected during the execution of . Compilers that produce code for Windows usually (but not always, of course), produce dynamic libraries in this format. (On other systems, the format of dynamic libraries is understandable, different.)

Rate-Library C++ is a set of standard functions that are required to be available to the program.

Static / Dynamic Libraries are not specified in the C++ language standard (not to be confused with the library!), its ranktime library can be implemented as you like to choose from the compiler authors. Practically, however, the current MSVC versions are implemented in both static and dynamic library formats.

In MSVC, you can also use any libraries, static (.lib) and dynamic (.dll). Since the ranktime library is in both options, you can, at your request, any of them.

Thus, both .dll and .lib can contain both the standard library and anything else.

became clearer?


(made from the comment, does not fit). When you connect .h, you declare the presence of some functions. So that the linker can find these functions, they must be somewhere.

If these features are in your code in another .cpp file, everything is already in order.

If these functions lie in the ranktime library, you need to connect it as a static or dynamic library. (But in the project it is already connected, the standard MSVC project connects to the ranktime. Or does not connect if you selected such settings.)

If you connect something else, here you yourself will have to connect the library in which the necessary functions are lying, otherwise the linker will not be able to find them.

So: You need to connect, just some libraries (for example, ranktime) are connected by default.


Answer 2, Authority 56%

Why do they need to enter the standard? These are the details of the implementation on a specific platform (in this case – on windows). Therefore, the phrase “already knowing” somehow sounds strange.

looked at the current standard. There is no word about DLL / LIB.


Answer 3, Authority 11%

As far as I understand, MSVC * .lib is a file of the archive, which in the general case stores the “External Symbol” comparisons set – a reference to the object (COFF or PE) file. This “symbol” at the stage of linking is either added to the executable image (in the case of COFF – from the precompiled object file), or is written in the import table (in the case of PE). Those. Some external links are broadcast to your EXE or dll , through the set of archive rules. Libraries, by and large – this is not, although it is called, oddly enough:

The Coff Archive Format Provides A Standard Mechanism for String Collections of Object Files. These Collections Are Commonly Called Libraries in Programming Documentation.

Source: Microsoft Portable Executable and Common Object File Format Specification

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions