Chapter 20. Writing Your Own DLLs
WHAT YOU WILL LEARN IN THIS CHAPTER
DLLs and how they work
When you should consider implementing a DLL
What varieties of DLLs are possible and what they are used for
How to extend MFC using a DLL
How to define what is accessible in a DLL
How to access the contents of a DLL in your programs
Chapter 9 discussed how a C++/CLI class library is stored in a .dll
file. Dynamic link libraries (DLLs) are also used extensively with native C++ applications. A complete discussion of DLLs in native C++ applications is outside the scope of a beginner's book, but they are important enough to justify including an introductory chapter on them.
UNDERSTANDING DLLS
Almost all programming languages support libraries of standard code modules for commonly used elements such as functions. In native C++, you've been using lots of functions that are stored in standard libraries, such as the ceil()
function that you used in the previous chapter, which is declared in the cmath
header. The code for this function is stored in a library file with the extension .lib
, and when the executable module for the Sketcher program was created, the linker retrieved the code for this standard function from the library file and integrated a copy of it into the .exe
file for the Sketcher program. If you write another program and use the same function, it will also have its own copy of the ceil()
function. The ceil()
function is statically linked to each application and is an integral part of each executable ...
Get Ivor Horton's Beginning Visual C++® 2010 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.