- All the symbols in a shared library are available at runtime. This is especially important with incremental linking of stars. If you have a shared
libg++, then you can use all the symbols in
libg++ in a star for which you did not use the
libg++ symbol at link time. If you use static linking, then when you incrementally link, you only have symbols that you used when you linked the binary. The same is true for symbols in the Ptolemy kernel and the domain kernels.
- You don't need to write dummy functions to pull in code from a library.
$PTOLEMY/src/domains/sdf/stars/sdfstars.c is an automatically generated C file that pulls in the stars from
libsdfstars.a. If you use shared libraries, then you need not have a
sdfstars.c file. Also, more than one person has been confused because they added new file containing new functionality to the Ptolemy kernel, and then when they tried to link in a star, the symbols they just wrote couldn't be found. Usually this is because they are not using the new symbols anywhere at link time, so the new symbols are not being pulled into the binary. If the Ptolemy kernel is a shared library, then this problem goes away, as the new symbols are present at incremental link time.
- Smaller binary size on disk. Shared library binaries are smaller on disk, so it is possible to have many versions of
pigiRpc that include different domains, without using up a lot of disk space. If you use shared libraries, a
pigiRpc is about 1.5Mb; if you use static libraries, then a
pigiRpc is about 8Mb.
- Link time is greatly decreased with shared libraries. Under Solaris with shared libraries, it takes almost no time to link a binary. Under SunOS with static libraries it can take 8 minutes to link. Using a tool like Pure Inc.'s
purelink can help, but
purelink is expensive and is not available everywhere.
- If you are running multiple
pigis on one machine, the memory usage should be reduced because of all the pigi binaries are sharing libraries. In theory, if a binary is built with static libraries, you should get some sharing of memory, but often the shared libraries result in better memory usage. If you use shared libraries for X11 and Tcl/Tk, then your memory usage should be lower.
dlopen() to incrementally link in new stars is usually faster than the older method of using
-A. Eventually, we may be able to link in entire domains at run-time using
Copyright © 1990-1997, University of California. All rights