Objective Grid : PART II Programmer’s Guide : Chapter 13 Objective Grid Concepts and Features : Automatic Linking
Automatic Linking
Objective Grid automatically links the appropriate static library or DLL to your project. You indicate exactly what libraries you want to include by defining combinations of _DEBUG, _AFXDLL, and _GXDLL in your Configuration Properties/C++ Project Preprocessor definitions (or in the Project Options box). The presence of _AFXDLL indicates dynamic linking to MFC. If it is absent, the project is statically linked to MFC. Similarly, the presence or absence of _GXDLL controls the linking of the Objective Grid Library.
The mechanics of this automatic linking are done in the file Include\grid\config\gxstndrd.h. This header file is included in gxall.h which you include in your stdafx.h. So any file that contains stdafx.h will include gxstndrd.h. This file uses a series of #ifdefs to conditionally define a name depending upon whether _AFXDLL and _GXDLL have been defined. The file then uses #pragma comment(lib, _GXAUTOLIBNAME) to tell the linker which library to use.
If you use the Build Wizard to define custom libraries, it places a new header file with the custom library name in the Include\grid\config folder. If you build a configuration named mycustomlibrary, you can have Objective Grid automatically link with mycustomlibrary, by including config\mycustomlibrary.h in your stdafx.h file.