Table of Contents Previous Slide Next Slide

Software Development in the UNIX Environment
Libraries

Creation of Static and Dynamic Libraries - sometimes different commands on different platforms

Example of Static Library Commands
ar -rt libmine.a file1.o file2.o file3.o
creates a static object library called libmine.a out of object files file1.o, file2.o, file3.o

Example of Dynamic Library creation
cc -pic -G -o libfoo.so file1.o file2.o file3.o (Sun Solaris)
ld -shared -o libfoo.so file1.o file2.o file3.o (SGI Irix)

Other compiler/linker options to note:
-B dynamic - use dynamic shared version of the library (default)
-B static - use static version of the library
Environment variable LD_LIBRARY_PATH - path to search for shared libraries