งานนำเสนอเรื่อง: "Static Libraries ธวัชชัย เอี่ยมไพโรจน์. Static Libraries It is the simplest form of library. It is a collection of object files kept together in a ready-to-use."— ใบสำเนางานนำเสนอ:
Static Libraries ธวัชชัย เอี่ยมไพโรจน์
Static Libraries It is the simplest form of library. It is a collection of object files kept together in a ready-to-use form. To use its functions: –include the header that declares the function. –Compile and link to the library. Know as “archives” name end with.a such as cgihtml.a Use “ar” command to create the static library.
Steps to create a static library. Create functions in files, such as: fred.c, bill.c then compile to get its object file like: fred.o bill.o etc. Create a header file which include function prototype of all functions in the library. Test the completeness of the object files. Use command as: –ar crv liba bill.o fred.o On some systems must use: (No need for Linux.) –ranlib lib.a
Disadvantage of static libraries. Many copies of the same functions in memory. UNIX also support shared libraries. (Not in our scope!). Named: –/lib/libc.so.N (N represent version number.) –/lib/libc.sa (Reference to share codes, not library itself.) Use command: (See which share library need by program). –ldd /usr/local/apache/bin/httpd