Library types in Linux
Two types of libraries exist on most operating systems: shared and static. On Windows, they are .DLL, for
dynamically linked library, and .LIB for static library.
On Linux and most Unix, they are .so and .a files. The shared libraries, the .so files, are loaded at runtime.
The .a files, or static libraries, are loaded at compile time and are no longer required to run the binary
program.
When you make a program, you must decide if you will link it to a static library or a shared one. You will
want a shared library in most cases because standard libraries are available on most systems, and would be
too big to include in a binary file.
If you have a small library that is not one of the standard ones that you need, then you may decide to include
it in your binary program. In that case, simply add it like any other object file in your compilation:
cc -o program file1.o file2.o library.a
Monday, February 25, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment