Can the make utility use object modules stored in an archive file?
3.
What does the term "reusable function" mean?
4.
Why would you profile a program?
5.
Which file is larger, a statically linked binary or a dynamically linked binary?
6.
How can you trick make into rebuilding all modules of your program?
7.
Describe briefly what the strip utility does.
Exercises
1.
Create a shared library with a simple function that returns an integer value. Then write a program to call this function and print its return value. After compiling and running the program, make a change to the library function that will change the return value of the function. Now rebuild the library, and relink your already compiled .o file(s) with it and run the program again. Which return value do you see this time? What happens if you rename the function in the shared library and try to relink your program? [level: easy]
2.
Compile "reverse.c" and "palindrome.c" and place them into an archive called "string.a". Write a main program in "prompt.c" that prompts the user for a string and then prints 1 if the string is a palindrome, and 0 if it is not. Create a makefile for the program that links "prompt.o" with the reverse () and palindrome () functions stored in "string.a". Use gdb to debug your code if any bugs exist. [level: medium]
Project
1.
Replace the original version of palindrome () stored in "palindrome" with a pointer-based version. [level: medium].