<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <div class="moz-cite-prefix">Hello Chin Luh,</div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">Le 04/12/2020 à 01:57, Chin Luh Tan a
      écrit :<br>
    </div>
    <blockquote type="cite"
cite="mid:CAMLxXcL-gYW4OjNPxV+iXsOSpb56np-ueT6_BfqdYHyk6xmjbQ@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">Hi all, 
        <div><br>
        </div>
        <div>Stephane, Thanks for the quick  examples to illustrate
          this.</div>
        <div><br>
        </div>
        <div>Claus, as shown by Stephane, this could be now by ourselves
          now from our own modules. Stephane has illustrated a quick
          demo on this, while the one I was testing with is the copy of
          toolbox skeleton inside the Scilab contrib, modified to 2
          modules, installed with atoms and let it load at start,
          results are the same. </div>
        <div><br>
        </div>
        <div>There are 2 potential issues which we should take notes: </div>
        <div>1. The module which is loaded last, will have the
          "dominant" in the base function. <br>
        </div>
      </div>
    </blockquote>
    <p>Are you sure about this? This was the rule with Scilab 5, but the
      removal of the variables stack changed it within Scilab 6. I
      noticed with Scilab 6.0 that the libraries are scanned for the
      required function only after sorting their names in
      anti-alphabetical order.<br>
      So if both alib.myfunc() and zlib.myfunc() exist, myfunc() will
      call zlib.myfunc(), whatever is the loading order of alib and
      zlib.<br>
    </p>
    <p>On this respect, neither the
      <a class="moz-txt-link-freetext" href="https://help.scilab.org/docs/6.1.0/en_US/library.html">https://help.scilab.org/docs/6.1.0/en_US/library.html</a> page is
      up-to-date, not other pages dealing with libraries, like the
      genlib().<br>
      Here is the test:</p>
    <pre style="font-family:Monospaced;font-style:normal;font-size:14.0;"><span style="color:rgb(0,0,0);">File</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(218,112,214);">TMPDIR</span><span style="color:rgb(92,92,92);">+</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">\test\</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(0,0,0);">mkdir</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">File</span><span style="color:rgb(92,92,92);">+</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">alib</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(0,0,0);">mkdir</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">File</span><span style="color:rgb(92,92,92);">+</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">zlib</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span>

<span style="color:rgb(0,0,0);">code</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(74,85,219);">[</span> <span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">function test()</span><span style="color:rgb(188,143,143);">"</span> <span style="color:rgb(0,0,0);">;</span> <span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">    disp(""test from alib"")</span><span style="color:rgb(188,143,143);">"</span> <span style="color:rgb(0,0,0);">;</span> <span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">endfunction</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(74,85,219);">]</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(50,185,185);">mputl</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">code</span><span style="color:rgb(0,0,0);">,</span> <span style="color:rgb(0,0,0);">File</span><span style="color:rgb(92,92,92);">+</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">alib\test.sci</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(50,185,185);">genlib</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">alib</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span> <span style="color:rgb(0,0,0);">File</span><span style="color:rgb(92,92,92);">+</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">alib</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span>

<span style="color:rgb(0,0,0);">code</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(74,85,219);">[</span> <span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">function test()</span><span style="color:rgb(188,143,143);">"</span> <span style="color:rgb(0,0,0);">;</span> <span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">    disp(""test from zlib"")</span><span style="color:rgb(188,143,143);">"</span> <span style="color:rgb(0,0,0);">;</span> <span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">endfunction</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(74,85,219);">]</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(50,185,185);">mputl</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">code</span><span style="color:rgb(0,0,0);">,</span> <span style="color:rgb(0,0,0);">File</span><span style="color:rgb(92,92,92);">+</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">zlib\test.sci</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(50,185,185);">genlib</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">zlib</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span> <span style="color:rgb(0,0,0);">File</span><span style="color:rgb(92,92,92);">+</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">zlib</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span>

<span style="color:rgb(50,185,185);">clear</span> <span style="color:rgb(188,143,143);">alib</span> <span style="color:rgb(188,143,143);">zlib</span>
<span style="color:rgb(50,185,185);">load</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">File</span><span style="color:rgb(92,92,92);">+</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">zlib\lib</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(74,85,219);">)</span>
<span style="color:rgb(50,185,185);">load</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">File</span><span style="color:rgb(92,92,92);">+</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">alib\lib</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(74,85,219);">)</span>

<span style="color:rgb(0,0,0);">test</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(74,85,219);">)

<font face="monospace">--> test()
  "test from zlib"</font>
</span></pre>
    <blockquote type="cite"
cite="mid:CAMLxXcL-gYW4OjNPxV+iXsOSpb56np-ueT6_BfqdYHyk6xmjbQ@mail.gmail.com">
      <div dir="ltr">
        <div>for e.g.: the example that Stephane showed, we could call
          "lib1.foo" and "lib2.foo", and calling just "foo" will be the
          same as  "lib2.foo".</div>
        <div>2. Only macros function could be called this way, if a
          module has a scilab gateway that called direct from Scilab,
          (such as scicv), you could not call scicvlib.imread as the
          imread is directly expose from the C lib to Scilab.</div>
      </div>
    </blockquote>
    <p>This is true only if the homonymous function is called without
      specifying its library. Otherwise, the name resolution works:</p>
    <pre style="font-family:Monospaced;font-style:normal;font-size:14.0;"><span style="color:rgb(0,0,0);">File</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(218,112,214);">TMPDIR</span><span style="color:rgb(92,92,92);">+</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">\test\</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(0,0,0);">mkdir</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">File</span><span style="color:rgb(92,92,92);">+</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">alib</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(0,0,0);">code</span> <span style="color:rgb(92,92,92);">=</span> <span style="color:rgb(74,85,219);">[</span> <span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">function cos(a)</span><span style="color:rgb(188,143,143);">"</span> <span style="color:rgb(0,0,0);">;</span> <span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">    disp(""cos() from alib"")</span><span style="color:rgb(188,143,143);">"</span> <span style="color:rgb(0,0,0);">;</span> <span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">endfunction</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(74,85,219);">]</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(50,185,185);">mputl</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">code</span><span style="color:rgb(0,0,0);">,</span> <span style="color:rgb(0,0,0);">File</span><span style="color:rgb(92,92,92);">+</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">alib\cos.sci</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(50,185,185);">genlib</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">alib</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span> <span style="color:rgb(0,0,0);">File</span><span style="color:rgb(92,92,92);">+</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">alib</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">;</span>
<span style="color:rgb(50,185,185);">clear</span> <span style="color:rgb(188,143,143);">alib</span>
<span style="color:rgb(50,185,185);">load</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(0,0,0);">File</span><span style="color:rgb(92,92,92);">+</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">alib\lib</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(74,85,219);">)

</span><span style="color:rgb(50,185,185);">cos</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">1</span><span style="color:rgb(74,85,219);">)</span>
<span style="color:rgb(0,0,0);">alib</span><span style="color:rgb(92,92,92);">.</span><span style="color:rgb(170,170,170);">cos</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">1</span><span style="color:rgb(74,85,219);">)

</span></pre>
    <p><font face="monospace">--> cos(1)<br>
         ans  =<br>
           0.5403023<br>
        <br>
        --> alib.cos(1)<br>
          "cos() from alib"</font><br>
    </p>
    <p>Best regards<br>
      Samuel<br>
      <br>
    </p>
  </body>
</html>