Singular Manual: load

| ### 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 executable program, and finally some default absolute directories. You can view the search path which uses to locate its libraries, by starting up 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 distinguish. 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 (T)
                         // the names of the procedures of inout.lib
      load("inout.lib"); // are now known to Singular
    ==> // ** loaded inout.lib (4.1.2.0,Feb_2019)
      listvar(package);
    ==> // Inout                          [0]  package Inout (S,inout.lib)
    ==> // Standard                       [0]  package Standard (S,standard.lib)
    ==> // Top                            [0]  package Top (T)
      load("blabla.lib","try");
      listvar(package);
    ==> // Inout                          [0]  package Inout (S,inout.lib)
    ==> // Standard                       [0]  package Standard (S,standard.lib)
    ==> // Top                            [0]  package Top (T)
      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)
    ==> // Tasks                          [0]  package Tasks (S,tasks.lib)
    ==> // Parallel                       [0]  package Parallel (S,parallel.lib)
    ==> // Resources                      [0]  package Resources (S,resources.lib\
       )
    ==> // Modular                        [0]  package Modular (S,modular.lib)
    ==> // Modfinduni                     [0]  package Modfinduni (S,modfinduni.l\
       ib)
    ==> // 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)
    ==> // Polylib                        [0]  package Polylib (S,polylib.lib)
    ==> // Nctools                        [0]  package Nctools (S,nctools.lib)
    ==> // Matrix                         [0]  package Matrix (S,matrix.lib)
    ==> // Inout                          [0]  package Inout (S,inout.lib)
    ==> // Standard                       [0]  package Standard (S,standard.lib)
    ==> // Top                            [0]  package Top (T)
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 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 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.1.2.0,Feb_2019)
      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.4.1, 2025, generated by texi2html.