Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function
genlib
builds a library from a set of *.sci files defining functions in a given directory
Syntax
genlib(lib_name) genlib(lib_name, dir_name) genlib(lib_name, dir_name, Force) genlib(lib_name, dir_name, Force, verb) genlib(lib_name [,path=dir_name] [,verbose=verb] [,force=Force])
Arguments
- lib_name
- Scilab string: The identifying name ascribed to the library to build.
- dir_name
- Scilab string: The pathname of the directory containing
.sci
functions files, and where thelib
file generated and defining the library will be stored. By default, the current working directory is considered.Thedir_name
directory and itslib
and.bin
files must be writable. - Force
- boolean value (default value is
%f
). Set it to%t
to force the sci-files recompilation. - verb
- boolean value (default value is
%f
). Set it to%t
to display more information during the build.
Description
genlib(..)
selects all files belonging to the
dir_name
directory and with the .sci
extension.
If any, subdirectories are never considered. If it is required, they must be compiled
apart into independent libraries.
Then, an XML editable file named lib
is created in the
dir_name
directory. The name lib_name
of the library is recorded into it.
Then, for each .sci
file:
- If
- there is no related
.bin
file indir_name
with the same basename (as for the initial build of the library), or - the content of the
.sci
file has changed since the previous build,
the
.sci
file is compiled (almost as it would be withexec(..)
):If it contains at least one
function .. endfunction
block, a.bin
binary file with the same basename is generated and stored indir_name
. It contains the binary code of ALL functions defined in the.sci
source file.- If the name of one of the function(s) defined in the
file is the basename of the
.sci
file, this function is registered in thelib
file. - Otherwise, no function from the
.sci
file is registered: Its whole content is considered as dead code.
If atest.sci
file defines thetest()
function AND other functions like sub(), sub() functions are then considered as private to test(). For instance,
Hence, sub() and other() won't exist out of test(), and won't be registered in the library.function r = sub(a) r = 2*a endfunction function test() disp("A test") endfunction function r = other(b) r = 2^b endfunction
is equivalent to function test() function r = sub(a) r = 2*a endfunction function r = other(b) r = 2^b endfunction disp("A test") endfunction
- If the name of one of the function(s) defined in the
file is the basename of the
- Otherwise, no
.bin
file is generated: The whole content of the.sci
file is considered as dead code.
- there is no related
- Otherwise: If the file's content has not changed and has already a function
entry in the
lib
file, this entry is kept.
Finally, genlib(..)
loads the created or updated library and sets
its identifier to a variable named lib_name
, in the current scope.
If the variable lib_name
already exists and is protected,
an error occurs: The library has been created but can't be loaded
(predef all can be used to unprotect the variable
named lib_name
before running genlib(..)
).
If the option force=%t
is used, all .sci
files
are compiled, even if their content has not changed.
When in the directory of a library some former .sci files have been removed while
all remaining .sci files are unchanged, rebuilding the library without the
force=%t
will anyway update the list of library's members.
If the option verbose
is true, more information is displayed during
the build process.
See also
History
Version | Description |
6.0.0 |
|
Report an issue | ||
<< Libraries | Libraries | get_function_path >> |