<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Well, after some trials and (mainly) errors,</p>
    <p>it seems that when saving a function which name is given by the
      variable function_name,<br>
    </p>
    <p>        save(function_name + ".bin", function_name)<br>
    </p>
    <p>does not work, while</p>
    <p>         execstr("save("""function_name + ".bin"","
      +function_name+")")<br>
    </p>
    does work.<br>
    <br>
    The attached file contains a routine that goes recursively through
    folders in a given path to find the .sci files and create a library
    in a given build folder. It works as follows,<br>
    <br>
        rgenlib(lib_name, src_path, target_path)<br>
    <br>
    It seems to be 'working' but produces warnings due to:<br>
    - the way binary files are saved (see above), which will change in
    Scilab 6 if I am correct,<br>
    - the functions in the library being already loaded in Scilab for
    some reason.<br>
    <br>
    If anyone has an insight concerning the second point, I am
    interested.<br>
    <br>
    Best regards,<br>
    <br>
    Pierre<br>
    <br>
    <div class="moz-cite-prefix">Le 12/10/2016 à 22:00, Pierre Vuillemin
      a écrit :<br>
    </div>
    <blockquote
      cite="mid:d9e6e49f-be71-0684-8b69-f5cee167aa26@pierre-vuillemin.fr"
      type="cite">
      <meta http-equiv="content-type" content="text/html;
        charset=windows-1252">
      <p>Hi all,</p>
      <p>I am trying to make a function similar to genlib but which goes
        recursively through folders to find .sci files, compile them and
        put them in a given target build folder.</p>
      <p>The idea is that I would like to be able to organize my
        'macros' folder while still being able to generate a library. In
        particular, I would like to have that kind of folder
        organization :</p>
      <pre>- build
</pre>
      <pre>    <binary files should go here>
</pre>
      <pre>    <as well as names></pre>
      <pre>- src
</pre>
      <pre>    - sub-folder1
</pre>
      <pre>        <.sci files>
</pre>
      <pre>    ...</pre>
      <pre>    - sub-folder n
        - sub sub folder 1
        <.sci files>
</pre>
      <pre>    < .sci files>
</pre>
      <p><br>
      </p>
      <p>At the moment, the function (build.sce in the attached file)
        goes through the folders contained in the initial 'src' folder,
        performs an 'exec' on the .sci files that are found, and save
        the corresponding binary files in the target folder 'build' (at
        the same level as 'src'). It also generates a 'names' file
        containing the names of the functions in the 'build' folder.</p>
      <p>Finally, it creates a library with the binary files contained
        in the 'build' folder.</p>
      <p><br>
      </p>
      <p>Yet, when I try to use my functions, I get the following error:</p>
      <p>  !--error 999 <br>
        Overloaded load cannot occur in this context <br>
      </p>
      <p>So I guess that there is something wrong with the way I
        generate my library?</p>
      <p>My binary files are generated as follows,<br>
      </p>
      <p>         function_name  = strsubst(fi,".sci","") // fi is the
        full name of the file<br>
                 names_to_write = [names_to_write;function_name] // used
        later to generate the file containing the names<br>
                 exec(file_path, -1)  // file_path is the absolute path
        to my function<br>
                 save(target_path + function_name + ".bin",
        function_name)<br>
      </p>
      <p>and the names file is generated as,</p>
      <blockquote>
        <p>  names_file = target_path  + "names"<br>
             [fd, err] = mopen(names_file,"a")<br>
             mputl(names_to_write, fd)<br>
             mclose(fd)<br>
        </p>
      </blockquote>
      <p><br>
      </p>
      <p>Best regards,</p>
      <p>Pierre Vuillemin<br>
      </p>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:users@lists.scilab.org">users@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>