Lib corresponds to DLL.
Lib is a static library file, and DLL is a dynamic library file.
The so-called static is to extract the required items from the link and arrange them to your EXE file for later running.
You no longer need Lib for your exe.
The so-called dynamic is that when the EXE runs, it depends on the functions provided in the DLL. Without this DLL, your EXE cannot run
Line.
Lib, DLL, and exe are all final target files and are final products. C/C ++Source code. SourceCodeAnd final
The intermediate code obj is used in the target file. In fact, it is impossible for you to get the object
. For example, an EXE requires many CPP files to be generated. The compiler can only compile one CPP file at a time. This
The sample compiler will compile a CPP into obj. When all required CPP files are compiled into OBJ
If one link is used as the required EXE, it should be said that the link of the EXE will fail if any obj is missing.
1. OBJ stores the compiled code and data with a name. Therefore, an unresolved external symbol will appear during the connection. After an EXE is connected, the name concept does not exist. Only the address is available. Lib is a combination of a bunch of obj.
2. Theoretically, but Lib is usually used in practice.
3. the compiler will link some frequently-used libraries by default. You must specify other libraries by yourself.
The difference between lib and DLL is attached.
(1) Lib is required during compilation and DLL is required during runtime.
If you need to complete source code compilation, it is enough to have Lib.
If dynamic connection is also enabledProgramIt is enough to run a DLL.
In the development and debugging stages, it is best to have both.
(2) common dynamic library programs include lib files and DLL files. The LIB file must be connected to the application during the compilation period, and the DLL file will be called only during the runtime. If there is a DLL file, the corresponding lib file is generally some index information, the specific implementation is in the DLL file. If only the Lib file is available, the Lib file is statically compiled and the indexes and implementations are all included. The advantage of static compiling lib files is that dynamic libraries are no longer needed during installation. However, there are also some disadvantages, that is, the application is relatively large and the flexibility of the dynamic library is lost. During version upgrade, new applications must be released at the same time.
(3) In the case of a dynamic library, there are two files, one is imported into the database (. lib) file. One is a DLL file. The imported file contains the name and location of the function exported by the DLL. The dll contains the actual function and data, the application uses the Lib file to link to the required DLL file. The functions and data in the library are not copied to the executable file. Therefore, in the executable file of the application, stores not the called function code, but the memory address of the function to be called in the DLL, in this way, when one or more applications are running, the program code is linked to the called function code, thus saving memory resources. From the above description, we can see that the DLL and. Lib files must be released along with the application, otherwise the application will produce errors.