|
|
The decision to use a shared library, should be based on whether it saves space in disk storage and memory. A well-designed shared library almost always saves space. As a general rule, use a shared library when it is available.
To determine what savings are gained from using a shared library, try building the same application with both a non-shared and a shared library, assuming both kinds are available. Then compare the two versions of the application for size and performance. For example:
$ cat hello.c main() { printf("Hello\n"); } $ cc -o unshared hello.c $ cc -o shared hello.c -lc_s $ size unshared shared unshared: 8680 + 1388 + 2248 = 12316 shared: 300 + 680 + 2248 = 3228
If the application calls only a few library members, it is possible that using a shared library could take more disk storage or memory. For a more detailed discussion see ``Space considerations''.