libname - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


The Predefined Variable libname

Description

• 

This special name specifies the file-system location of the main Maple library and other libraries such as package libraries and user libraries. Its value is a string or sequence of strings. By setting libname to a sequence of strings, you can specify locations that are sequentially searched for routines.  Each location must be a directory that contains a hierarchy of Maple .m files or Maple archives, or the full path of the .mla or .lib file of a Maple archive (see march).

• 

A repository can be created using the command march('create',"filename"), where "filename" is a string specifying the location of a .mla or .lib file.  Name/value pairs can be saved in a library by setting the global variable savelibname, and calling savelib('name') (see savelib). Values can be retrieved from a repository by assigning libname := (libname, "filename").  After "filename", or the directory containing "filename" is in your library search path, the name/value pairs stored in that repository are automatically assigned.  For example, the following sequence of commands shows how to create a repository, save a procedure named dostuff, and access it after restart.

> march('create',"/home/user.mla");

> dostuff := proc(x) x^2; end proc:

> savelibname := "/home/user.mla":

> savelib('dostuff'):

> restart;

> libname := libname, "/home/user.mla":

> dostuff(3);

                                   9

• 

When the value of libname is a sequence of strings (directory paths or .mla and .lib file paths), Maple searches the specified libraries (in the order specified by the sequence) for the named routine or package of routines. If a directory contains more than one library, Maple searches the libraries in the priority order specified in the archive. For more details on archive priority, see march. For example, the commands:

> libname := "/usr/me/mylib/joe.mla","/usr/maple/lib";

> myexpand;

  

result in the two specified locations being searched for a definition of myexpand in a file or a member named myexpand.m. First the single library "joe.mla" in the directory "/user/me/mylib" is searched, and  then, if necessary, the libraries in the directory "/usr/maple/lib" are searched. The search is terminated on its first success.  In particular, this mechanism allows for easy additions or replacements to the main library.

• 

The locations of user-created Maple help databases (.help files) can also be added to libname.  See About Help Databases in Maple and View a Help File as a Help Page for more information.

• 

To see its current value, enter libname; at the Maple prompt. Notice that any names assigned to libname are converted to strings.

• 

The libraries of any installed toolboxes are appended to libname in alphabetical order by toolbox directory name, based on the notion of ordering in a standard directory in the local operating system.

• 

Users can assign an initial value for libname on the command line or in their initialization files.  See maple for details. Automatic loading of Maple library functions is accomplished by using this global variable, so users are advised not to change it in the middle of a session.

See Also

file

index/function

initialconstants

maple

read

save

savelib

with

worksheet/reference/helpdatabase