Header file commonly used to define an interface or set of interfaces in an application. Think of the header file as something that shows the external functionality of the program, while omitting the details of the technical implementation.
For example, if you optimized the program, you are likely to modify the source file (.cpp) to improve the algorithm, but the header file will not change, because external clients still call methods using the same set of parameters and return values.
In an object-oriented language such as C ++, the header file usually includes the following:
- Class Description and Inheritance Hierarchy
- Members and class data types
- Class methods
While there is no stop code in the header file, this is usually not recommended as it may introduce additional additional relationships and dependencies in the code.
In some cases (for example, template classes), the implementation must be defined in the header file for technical reasons.
A library is a collection of code that you want to make available to a program or group of programs. It includes the implementation of a specific interface or set of interfaces.
Code is defined in the library to prevent code duplication and encourage reuse. A library can be statically linked (.lib) or dynamically linked (.dll):
A statically linked library defines a set of export symbols (which can be thought of as method definitions), which are then linked in the final executable (.exe) at the stage of linking the build process. This has the advantage of faster execution time (since the library does not need to be dynamically loaded) due to the larger binary file (since the methods are essentially replicated to the executable).
A library with dynamic linking is associated with the execution of the program, not with the binding of the program. This is useful when several programs must reuse the same methods and are widely used in technologies such as COM.
LeopardSkinPillBoxHat May 29 '09 at 5:25 a.m. 2009-05-29 05:25
source share