[Scilab-users] {EXT} Re: Functions lib

Samuel Gougeon sgougeon at free.fr
Fri Sep 23 10:59:43 CEST 2016


Le 22/09/2016 09:48, Dang Ngoc Chan, Christophe a écrit :
> .../...
> There is also the quick and dirty way :
> put it in a *.sci file as mentioned,
> and read this file with an exec() or getd()
> in the Scilab code.
> But the effort for learning how to declare it in an *.ini file
> can spare you some effort latter.
>
> You might also look at the "library" section of the help:
> https://help.scilab.org/docs/6.0.0/en_US/section_b0e75452c88728d23bbe1cbd7fad7b12.html
>
> I don't know now, but before, you had to create a directory containing:
> * a file named "name" (without any extension),
> which is an ascii file containing the names of the functions;
.
That's true, this is required for Scilab 5, and no longer for Scilab 6.
> * for each function, create a *.bin file with the name of the function
> with : save("function_name.bin", function_name);
.
This is not enough. The "lib" file is also required. It is generated 
with genlib(..)

> * call the library with the lib() command.
>
> The advantage compared with the simple *.sci method
> Is that you can have several functions with the same name,
> e.g. if you defined an f() function in the library lib1 and in the library lib2,
> you can call them with lib1.f() and lib2.f().
> Not sure that it is worth investing in this knowledge.
.
When an unprotected function registered in a (protected) library is cleared,
calling it again looks for it in existing libraries and reloads it 
automatically.
This is not the case after clearing a function loaded with exec(). Its 
reference is then lost.

Samuel Gougeon





More information about the users mailing list