KLayout Manual: Main Index » Various Topics » About Libraries

About Libraries

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:

  • As ordinary layout files: Such libraries are simple layout files (GDS, OASIS or other support format). KLayout looks up those libraries in the "libraries" subfolders of the search path and gathers all layout files it finds there into the library repository.

    The search path usually includes the installation site (where the KLayout executable resides) and the application folder (i.e. "~/.klayout" on Linux). Hence libraries can be installed locally (i.e. in "~/.klayout/libraries") or globally (at the installation site).

    For GDS files, the library name will be the LIBNAME of the GDS file. Otherwise it will be the name of the library file minus the extension.

  • Coded libraries: Such libraries are provided by code, either through shared objects/DLL's or through Ruby code. Basically such code has to provide a layout object containing the library cells. A coded library can also provide PCell's (parametrized cells) as library components. Sell About PCell's for details about parametrized cells.

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.