Graphics Reference
In-Depth Information
examples of how to use the provided facilities in the library. In our case, the
tutorials in this textbook serves as the sample code, whereas the explanation
accompanying each tutorial serves as the manual for our libraries.
Header files. This is to support compilation of the programming code
based on our libraries. For example, if a programmer wants to declare a
CSliderCtrlWithEcho object, she must include the SliderCtrlWithEcho
.h file; otherwise, at compile time, the compiler will not understand what a
CSliderCtrlWithEcho is. In all of our libraries, we have a library header
file that includes all of the classes/functions defined in the library. For ex-
ample, for UWB _ MFC _ Lib1 ,thefile uwbgl _ MFC _ Lib1.h includes all the def-
initions for all the classes and functions defined in this library. A developer
only needs to include this file to take advantage of facilities provided by
this library.
The advantage of one dedicated library header file is in its simplicity: de-
velopers only need to know about this single file. The main disadvantage
comes in the form of compilation time; including all definitions in a library
means the compiler must process much more information. We chose this
approach mainly for the simplicity. In all of our tutorial projects, the li-
brary header files are included in the StdAfx.h file. Because all source
files must include this precompiled header file, all source files have access
to all functionality provided by our libraries.
The library. This is to support linking of the programming code based on
our library. In modern development environments, software libraries typ-
Library file. Library files typ-
ically end with .lib or .dll
in the Microsoft Windows en-
vironment. Other examples of
library extensions include .a
and .dso in the Unix environ-
ment.
ically come in the form of a file. This file contains all the machine code
for all the functions/classes defined in the library. At link time, a devel-
oper's compiled code will be linked with the contents of this library file.
For example, if a programmer has properly included the SliderCtrlWith
Echo.h file and declared an object for this class, at link time, the linker will
locate and extract the machine code that implements the SliderCtrlWith
Echo functionality.
In modern development environments, there are two types of software li-
braries: statically linked and dynamically linked. Statically linked libraries
are processed at link time, where the machine code is included in the ex-
ecutable program. Dynamically linked libraries support the loading of the
library at run time. We have chosen to work with statically linked libraries
for simplicity.
The result of compiling our library project is a .lib file. For example, for
the MFC _ Library1 project, the result of compilation is the MFC _ Library1
Search WWH ::




Custom Search