Scilab Function

lib - library definition

Sequence d'appel

xlib = lib('lib-dir')

Parametres

Description

lib-dir is a character string defining a directory that contains compiled Scilab function (.bin) files. In addition to these files lib-dir must have a file called names, that contains the names of the functions defined in lib-dir. On success, all functions in lib-dir are available from within Scilab. They are loaded on demand when called for the first time.

Binary files can be created from within Scilab with the command save.

Scilab's standard libraries are defined using lib on the SCIDIR/macros/* subdirectories.

As an example, given the following definitions

    deff('z = myplus(x, y)', 'z = x + y')
    deff('z = yourplus(x, y)', 'x = x - y')
    lib_dir = '/home/joeuser/myscidir'
   

myplus and yourplus are compiled into lib_dir with the commands

    save(lib_dir + '/myplus.bin', myplus)
    save(lib_dir + '/yourplus.bin', yourplus)
   

A library can now be created from the two .bin files with the command

        xlib = lib(lib_path + '/')
   

xlib is a Scilab variable of type "library". A library variable usually is saved for later loading, either on-line or from the user-specific startup file ($HOME/.scilab).

RESTRICTIONS

Exemples

Voir aussi