mylib = lib(libdir) registers functions in the default library instead of in the LHS one
Reported by Samuel GOUGEON (@sgougeon)
BUG DESCRIPTION:
----------------
Let mylib be a library generated with genlib("mylib"). This makes "mylib" the default library name, recorded in the lib file.
In Scilab 5.5, when we call
myLIB = lib(libdir)
the functions are registered in as members of the myLIB library, not of the mylib one.
Then, whereis("a_function_of_the_lib") returns myLIB, not mylib.
This is consistent, and allows calls such as libraryinfo(whereis("a_function_of_the_lib")).
In Scilab 6.0, lib() registers functions in mylib, while the only handle generated is the LHS one, so myLIB.
Hence, "mylib" is an unknown identifier: whereis("a_function_of_the_lib") returns it,
but libraryinfo(whereis("a_function_of_the_lib")) fails!
This makes hardly trackable issues, noticeably in external modules..!
--> path = TMPDIR+"\tmp\";
--> mkdir(path);
--> mputl("function myfun(), disp(""1234""); endfunction",path+"myfun.sci");
--> genlib("myfunlib", path);
--> clear myfunlib
--> myLIB = lib(path);
--> myfun()
1234
--> whereis("myfun")
ans =
myfunlib
--> myfunlib
Undefined variable : myfunlib
ERROR LOG:
----------
Wrong behavior
HOW TO REPRODUCE THE BUG:
-------------------------
path = TMPDIR+"\tmp\";
mkdir(path)
mputl("function myfun(), disp(""1234""); endfunction",path+"myfun.sci")
genlib("myfunlib", path);
clear myfunlib
myLIB = lib(path);
myfun()
whereis("myfun")
myfunlib
OTHER INFORMATION:
------------------
Bug detected where porting the SIMM module to Scilab 6.
As well, some issues in loading Celestlab in Scilab 6 could come from this bug.