how to create a static library in c language

www.lau‮utt‬ri.com
how to create a static library in c language

command:

$ ar rc libutil.a util_file.o util_net.o util_math.o

This command creates a static library named "libutil". And put the copies of object files "util_file. o", "util_net. o" and "util_math. o" into it.
If the library file already exists, the object file will be added to the library. If the object file is newer than the object file in the library, the object file will be replaced.
If the library does not exist,
The "c" flag tells ar to create the library.
The "r" flag tells it to replace the older object file in the library with the new object file.

Created Time:2017-08-28 05:43:39  Author:lautturi