开发经验

1、Use Grep to search for header files for definition and function

It’s often convenient to use the grep command to search header files for particular definitions and function
prototypes. Suppose we need to know the name of the #defines used for returning the exit status
from a program. Simply change to the /usr/include directory and grep for a probable part of the
name like this:
$ grep EXIT_ *.h
...
stdlib.h:#define EXIT_FAILURE 1 /* Failing exit status. */
stdlib.h:#define EXIT_SUCCESS 0 /* Successful exit status. */
...


2、use nm to check which functions are included in an object file or exes


If we take a look at program and lib.a, we see that the library contains both fred and bill,
but that program contains only bill. When the program is created, it includes only functions from the library that it actually needs. Including the header file, which contains declarations for all of the functions in the library, doesn’t cause the entire library to be included in the final program.

3、
One disadvantage of static libraries is that when we run many applications at the same time and they all use functions from the same library, we may end up with many copies of the same functions in memory
and indeed many copies in the program files themselves. This can consume a large amount of valuable memory and disk space.

你可能感兴趣的:(UP)