A symbol table is used by computer systems as a way of centralizing information and reducing the size of programs. These tables work like the key to a secret code; a symbol or string is placed next to another, generally much larger, piece of information. When a program reads a symbol that is associated with the symbol table, the program references the table and takes the information rather than the symbol. This allows large pieces of information or commonly repeated structures to only have one entry, reducing the overall size of the program.
The concept behind a symbol table is very simple. A single table contains a wide range of information used by a program, each with its own entry and unique associated symbol. This information could be strings of code, debugging information, memory locations, literally anything that the program could use in order to function. Rather than include that information within the program, the code simply references the table using its unique symbol.
There are two places where a symbol table is common: in the compiling of code into programs and in linking libraries used by multiple programs. When used in programs, the actual table is typically absorbed into the program or made into a shared library at the time of compiling. It is unusual to leave the list separate, as altering the list could have extreme consequences for the program. Even when the table is transformed in this process, it is still the same basic thing, it is just included along with other code.
When a symbol table is used in a linking library, the possibilities for how it can work expand drastically. A linking library is a set of information that is assumed to be available to a program at any time. These libraries are often shared by an operating system or a family of related programs that are all made by the same company.
Each of these libraries is filled with information on certain subjects. One library may contain a wide array of programming for drawing the window borders of the operating system’s user interface while another may contain information about where a specific group of programs store information in memory. Since a linking library may contain such random assortment of information, symbol tables are often included with them.
By incorporating a symbol table into a linker, it is possible to share the symbols across a program series. This allows multiple programs access to the same data at any time. If a large number of programs all require the same information, including it within a symbol table in a library vastly reduces the size of the total program group.