dynamic-link libraries (DLLs), Static link libraries (LIB), import libraries for dynamic-link libraries (lib)
At present, there are two libraries with Lib suffix, one for static link library (static libary, hereinafter referred to as "still Library"), the other is the import library for dynamic Connection libraries (DLL, hereinafter referred to as "Dynamic Library") (Import libary, hereinafter referred to as "Importing library").
A static library is the packaging of one or more obj files, so someone simply makes the process of generating lib from the obj file known as archive, that is, merging together. For example, you link a static library, if there is a mistake, it will be accurate to find which obj is wrong, that is, static lib is only shell.
Dynamic libraries generally have a corresponding import library, convenient program static load dynamic link library, otherwise you may need to loadlibary into the DLL file, and then manually getprocaddress to obtain the corresponding function. With the import library, you only need to link to import library and follow the declaration of the header file function interface to invoke the function.
The difference between an import library and a static library is great, and they are not the same thing. The static library itself contains the actual execution code, the symbol table, and so on, and for the import library, its actual execution code is in the dynamic library, the import library contains only the address symbol table, and so on, ensuring that the program finds some basic address information for the corresponding function.
This is also how many open source code is actually published:
1. Precompiled development Package: contains some. dll files and some. lib files. The. Lib here is the import library, not the wrong way to think of it as a static library. However, as in the case of static libraries, the path to find these. Lib is added to the link path. and. dll is best placed in the same directory as the last application exe execution file. When you run this, the dynamic link library is automatically transferred.
2. The user compiles: downloads the source code, compiles itself according to the readme. The build is likely to be a library file for a. dll +. lib (import library)
3. If you only have a DLL and you know the function prototype of a function in a DLL, you can use Loadlibary in your own program to transfer the DLL file directly, GetProcAddress
Dll:
A dynamic-link library (DLL) is an executable file that is used as a shared function library. Dynamic linking provides a way for a process to invoke a function that is not part of its executable code. The executable code for a function is in a DLL that contains one or more functions that have been compiled, linked, and stored separately from processes that use them. DLLs also help you to share data and resources. Multiple applications can access the contents of a single DLL copy in memory at the same time.
A dynamic link differs from a static link in that it allows an executable module (a. dll file or an. exe file) to contain only the information needed to locate the executable code for the DLL function at run time. In static links, the linker gets all the referenced functions from the static link library and places the library with the code in the executable file.
There are several advantages to using dynamic links instead of static links. DLLs save memory, reduce switching operations, save disk space, make it easier to upgrade, provide after-sale support, provide a mechanism to extend the MFC library classes, support multi-language programs, and make international versions easier to create.
The API is the application programming interface. It is a set of functions that can be used to manipulate components, applications, or operating systems. Typically, the API consists of one or more DLLs that provide some special functionality.
DLL is a file that contains the Microsoft? Windows? A function that can be called by any application running under. At run time, functions in the DLL are dynamically linked to the application that called it. No matter how many applications call a function in the DLL, only one file on disk contains the function, and the DLL is created only when it is transferred into memory.
The most common API you hear may be the Windows API, which includes the various DLLs that make up the Windows operating system. Each Windows application interacts directly or indirectly with the Windows API. The Windows API guarantees that all applications running under Windows behave in a consistent manner.
Note with the development of the Windows operating system, several versions of the Windows APIs are now published. Windows 3.1 uses the Win16 API. Microsoft? Windows NT?, Windows 95, and Windows 98 platforms use Microsoft? Win32? Api.
In addition to the Windows API, some other APIs have been published. For example, Messaging Application programming Interface (MAPI) is a set of DLLs that can be used to write e-mail applications.
APIs have traditionally been written for C and C + + programmers who develop Windows applications, but other programming languages (including VBA) can also invoke functions in DLLs. Because most DLLs are written and collated primarily for C and C + + programmers, the method of calling a DLL function differs from calling a VBA function. You must know how to pass arguments to a DLL function when you use the API.
Warning calling the Windows API and other DLL functions can have a bad effect on your application. When you call DLL functions directly from your own code, you bypass some of the security mechanisms that VBA typically provides. If an error occurs when defining or calling a DLL function (unavoidable for all programmers), it can cause application errors (also known as generic protection errors, or GPF) in the application. The best solution is to save the project before running the code and make sure that you understand the rationale for DLL function calls.
LIB creates standard libraries, imports libraries, and export files, which you can use with LINK when you build 32-bit programs. LIB runs from a command prompt.
You can use LIB in the following modes:
Build or modify the COFF library
To extract a member object into a file
Creating export files and import libraries
These patterns are mutually exclusive, and LIB can only be used in one mode at a time.
Http://blog.csdn.net/clever101/archive/2010/01/11/5176254.aspx