Home Articles Books Download FAQs Tips

General IDE:
Add the Sample controls individually (don't use SAMPREG.CPP)

This tip applies only to C++Builder version 1.0.

The Sample controls that come with C++Builder are pretty cool. My favorites are the Pie control, and the ColorGrid. The README.TXT file that is located in the EXAMPLES\CONTROLS directory tells you to install the controls by installing SAMPREG.CPP. However, you should probably ignore this statement and install each CPP file separately.

The problem with SAMPREG.CPP is that it compiles all of the sample controls into one OBJ file. When you use one sample control, this combined OBJ gets linked into your problem. The downfall of SAMPREG.CPP is that the code for all of the sample controls gets added to your EXE, even if you only use one sample control in your program. This means that if you only use the ColorGrid control, your EXE will contain the code for the ColorGrid control, the Pie control, the Gauge control, and all of the remaining sample controls. Your EXE ends up 130k or so bigger than it needs to be.

By installing each component separately, you keep your EXE as lean as possible.

Note: Many third party controls use a single CPP or PAS to install a group of controls. If the installation file is designed correctly, you will not witness the same code bloat for your third party controls that you see with the sample controls. Contact your vendor if you have questions.



Copyright © 1997-2000 by Harold Howe.
All rights reserved.