### 5.2.12 load

`Syntax:`
  `load(` string_expression `);`
  `load(` string_expression `,` string_expression `);`
`Type:`
  none
`Purpose:`
  reads a library of procedures from a file. In contrast to the command `LIB` (see note below), the command `load` does not add the procedures of the library to the package `Top`, but only to the package corresponding to the library. If the given filename does not start with `.` or `/`, the following directories are searched for it (in the given order): the current directory, the directories given in the environment variable `SINGULARPATH`, some default directories relative to the location of the SINGULAR executable program, and finally some default absolute directories. You can view the search path which SINGULAR uses to locate its libraries, by starting up SINGULAR with the option `-v`, or by issuing the command `system("with");`.

  The second string selections options for loading.

`Note: `load(<string_expr>,"with")` is equivalent to`
  `LIB <string_expr>`.
`Note: `load(<string_expr>,"try")` is equivalent to`
  `LIB <string_expr>` which never fails - test the package name to distiguish.

All loaded libraries are displayed by the `listvar(package);` command:

      option(loadLib);   // show loading of libraries;
                         // standard.lib is loaded
      listvar(package);
    ==> // Standard                       [0]  package Standard (S,standard.lib)
    ==> // Top                            [0]  package Top (N)
                         // the names of the procedures of inout.lib
      load("inout.lib"); // are now known to Singular
    ==> // ** loaded inout.lib (4.0.0.0,Jun_2013)
      listvar(package);
    ==> // Inout                          [0]  package Inout (S,Inout)
    ==> // Standard                       [0]  package Standard (S,standard.lib)
    ==> // Top                            [0]  package Top (N)
      load("blabla.lib","try");
      listvar(package);
    ==> // Inout                          [0]  package Inout (S,Inout)
    ==> // Standard                       [0]  package Standard (S,standard.lib)
    ==> // Top                            [0]  package Top (N)
      option(noloadLib);   // do not show loading of libraries;
      load("matrix.lib","try");
      listvar(package);
    ==> // Elim                           [0]  package Elim (S,elim.lib)
    ==> // Triang                         [0]  package Triang (S,triang.lib)
    ==> // Absfact                        [0]  package Absfact (S,absfact.lib)
    ==> // Primdec                        [0]  package Primdec (S,primdec.lib)
    ==> // Ring                           [0]  package Ring (S,ring.lib)
    ==> // Random                         [0]  package Random (S,random.lib)
    ==> // General                        [0]  package General (S,general.lib)
    ==> // Poly                           [0]  package Poly (S,poly.lib)
    ==> // Nctools                        [0]  package Nctools (S,nctools.lib)
    ==> // Matrix                         [0]  package Matrix (S,Matrix)
    ==> // Inout                          [0]  package Inout (S,Inout)
    ==> // Standard                       [0]  package Standard (S,standard.lib)
    ==> // Top                            [0]  package Top (N)

Each time a library ( Libraries) / dynamic module ( Dynamic loading) is loaded, the corresponding package is created, if it does not already exist.

The name of a package corresponding to a SINGULAR library is derived from the name of the library file. The first letter is capitalized and everything to right of the left-most dot is dropped. For a dynamic module the packagename is hard-coded in the binary file.

Only the names of the procedures in the library are loaded, the body of the procedures is read during the first call of this procedure. This minimizes memory consumption by unused procedures. When SINGULAR is started with the `-q` or `--quiet` option, no message about the loading of a library is displayed.

      option(loadLib); // show loading of libraries; standard.lib is loaded
                       // the names of the procedures of inout.lib
      load("inout.lib"); // are now known to Singular
    ==> // ** loaded inout.lib (4.0.0.0,Jun_2013)
      listvar();

See Command line options; Dynamic modules; LIB; Procedures and libraries; SINGULAR libraries; exportto; importfrom; package; proc; standard_lib; string; system.

User manual for Singular version 4-0-3, 2016, generated by texi2html.