Starting with version 0.22, KLayout offers a library concept. Libraries are a way to import cell layout into a layout from the outside and thus a convenient way to provide standard building blocks for the layout. Using a cell from a library is easy: when asked for a cell, select the library where to take the cell from and choose a cell from that library.
Libraries are basically just foreign layouts that are virtually linked to the current layout. When a cell is imported from a library, it is copied into the current layout, so that the current layout by itself is a valid entity.
When a layout containing library references is saved, KLayout stores some meta information in that file which allows it to restore the library links and related informations. For GDS, that meta information is stored in a separate top cell. For OASIS, the meta information is stored in special per-cell properties. For other formats, the meta information is not stored currently.
Libraries can be provided in several ways:
Libraries are loaded on startup and reside in memory while KLayout is running. Therefore, in order to update a library when the content has changed, KLayout must be restarted.