Objective Grid : PART I User’s Guide : Chapter 6 Reducing the Size of Your Application
Chapter 6 Reducing the Size of Your Application
How Objective Grid Affects the Size of Your Application
Objective Grid consists of many thousand lines of code that implement a whole variety of different features and cell types. While some features and cell types might be essential for your application there will be many other features or cell types that are not needed in your application. Objective Grid gives you the option to choose the features and cell types you need in your application. Any unwanted features can be excluded. This allows you to minimize the distribution size of your application. The overhead added by Objective Grid to your application varies between 150 KB and 1,500 KB depending on how many cell types and features you link into your application.
Objective Grid offers two alternatives to be distributed with your application:
Using Objective Grid as a shared DLL.
Linking Objective Grid static into your application.
There are special considerations what solution is better for your specific project(s).
Using Objective Grid As a Shared DLL
Using Objective Grid as a shared DLL is recommended if your project consists of several executable files. The advantage of this solution is that all executables in your project can share the same DLL that implements the grid functionality.
Another advantage of this solution is a reduced linking time for your project. This is advantageous while doing development of your application. Once you build a release version of your project this linking time of your project should not be a criteria any more.
When you use Objective Grid as shared DLL all features that you want to use in any of your applications must be linked into the DLL. Objective Grid allows you to reduce the size of the DLL through its “Build Wizard” tool discussed later. The size of individual executables is not depending on the number of features and cell types linked into the Objective Grid DLL.
The main step for linking Objective Grid as shared DLL is to define _GXDLL in your project’s C/C++ compiler settings.
Linking Objective Grid Statically
Linking Objective Grid statically into your application is recommended if your project consists only of one executable. This solution has the advantage that you don’t have to worry about redistributing the Objective Grid DLL with your application.
When you link Objective Grid statically into your application the Visual C++ Linker will link only to those Objective Grid modules that are referenced in your application. Independent features and cell types are implemented in different modules. In your application you can implement a “Control Factory Class”. This class establishes references to features and cell types you want to use in your application. Objective Grid helps you with creating such a Control Factory Class though the Build Wizard tool. If you don’t create an individual Control Factory Class for your application, Objective Grid will use a default Control Factory Class provided by the library that forces all features and cell types available in the static library to be linked into your application. Control factory classes and and how they work with the Build Wizard are discussed in more detail in “The Control Factory Class” and “The Build Wizard”.
So, when you link Objective Grid statically, you can choose features and cell types individually for each application. Therefore it is recommended that you generate static Objective Grid libraries with all features and cell types linked into the library. You can then use the same static library for many different projects.
With DLLs you should create an individual DLL for each project that needs a different set of grid features and cell types.
NOTE >> We recommend that you create Objective Grid libraries that provide all cell types and features. Use the Control Factory dialog screen of the Build Wizard instead to select those features you want to link into individual applications. The Visual C++ linker automatically binds only modules that are referenced in your project and in the project's control factory. If you want to ship your application using Objective Grid as DLL you can later run the Objective Grid Build Wizard and create DLLs that are as small as possible.
Let’s discuss the Control Factory Class, and Build Wizard in more detail.