: I've been setting up a C++ development environment for several
: programmers,
: and we have our application divided into multiple sub-projects. Each of
: these sub-projects, usually one GUI screen, is located in its own
: directory.
: This is all on UNIX (Sun), using SCCS for configuration management.
: Each subproject is developed independently from the others, and each
: of these subprojects has its own static library. Consequently, we have
: quite a few files such as libScreenA.a, libScreenB.a, etc...
Sounds a good way of doing it. We do much the same thing, usually have
a library for each directory of source code. We have had programs linked
from about 50 libraries on occasions.
: The directory structure has a "master" makefile, which links all of
: these
: library files into one executable. The whole system is working very
: well for us, however I am concerned about the size of the resulting
: program. It is around 5.5 MB now, although it does include debugging
: info still.
Use size command, or try stipping the executable to see how much is debug
information and how much is code. You also need to add an estimate for
dynamic memory usage to get an idea of the memory needed at run time.
: Would the resulting executable be smaller if we didn't build it from
: multiple libraries? If libraries are interdependent, we sometimes have
: to list them two or three times in the LIBS section of the makefile...
: does this cause extra code to be inserted into the executable, as well?
No, ld only should pull any object in once so the size will be the same.
We have done this alot and never had problems. See what map file options
your linker offers so you can see what code is pulled in (Probably -m.)
You might also investigate if you ld has the -y <symbol> option to trace
specific symbols.
If you wish to reduce repetitions of libraries to improve link speed
look at the lorder command or using the -u <symbol> switch to the linker.
Excesive use of -u can result in maintenace problems so be selective.
If you have an extreamly large program you might be able to improve performance
by carefull ordering of the object files in the image (by controling the
ordering they are linked) to reduce paging. However unix does not offer many
tools to help decide and obtain a good order or so I would not try doing
anything unless you have real problems. Even then a better solution would be to
consider if you really need one integrated application or if you can spawn sub
applications from another.
--
Philips Semiconductors Ltd
Southampton My views are my own.
United Kingdom
Are you using ISO8859-1? Do you see ? as copyright, as division and ? as 1/2?