<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Thanks Samuel, the problem is that<br>
      <br>
      save('macros/%axesData_i_h.bin', '%axesData_i_h<font
        color="#ff0000"><font size="+1">'</font></font>) <br>
      <br>
      will produce a .sod file with a .bin extension. Both formats
      cannot be used indifferently for compiled macros of a library : in
      the following code (that can be copy/pasted), a library is built,
      the "fun1" function is saved in sod format, then the reference to
      "fun1.bin" is replaced by "fun1.sod" in the lib file :<br>
      <br>
      path=TMPDIR+'/test/';<br>
      mkdir(path)<br>
      mputl('function y=fun1(x), y=x, end',path+'fun1.sci');<br>
      genlib('test',path)<br>
      save(path+'fun1.sod','fun1')<br>
      doc=xmlRead(path+'lib');<br>
      doc.root.children(1).attributes.file='fun1.sod';<br>
      disp(xmlDump(doc))<br>
      xmlWrite(doc,path+'lib');<br>
      clear<br>
      lib(TMPDIR+'/test/')<br>
      <br>
      The following output is obtained:<br>
      <br>
      !<?xml version="1.0" encoding="UTF-8"
      standalone="no"?>                         !<br>
!                                                                              
      !<br>
      !<scilablib
      name="test">                                                       
      !<br>
!                                                                              
      !<br>
      !  <macro name="fun1" file="fun1.sod"
      md5="a50d8a8cda2cd6036306e08e61ffcbeb"/>  !<br>
!                                                                              
      !<br>
!</scilablib>                                                                  
      !<br>
      <br>
      Emplacement des fichiers des fonctions : /.<br>
      <br>
      fun1  <br>
      <br>
      --> <br>
      <br>
      Unfortunately, calling fun1 crashes scilab...<br>
      <br>
      <br>
      S.<br>
      <br>
      Le 28/02/2018 à 15:09, Samuel Gougeon a écrit :<br>
    </div>
    <blockquote type="cite"
      cite="mid:7fa5524f-cc29-0485-5da0-ded11de067ac@free.fr">
      <div class="moz-cite-prefix">Hello Stéphane,<br>
        <br>
        I would try the following:<br>
        After genlibing the set of regular .sci files,<br>
        * save the clone with <br>
           save('macros/%axesData_i_h.bin', <font size="+1"
          color="#ff0000">"</font>%axesData_i_h<font size="+1"
          color="#ff0000">"</font>) <br>
        * add a line in the lib file<br>
        <pre style="font-family:Monospaced;font-style:normal;font-size:12.0;"><span style="color:rgb(92,92,92);">   <</span><span style="color:rgb(0,0,0);">macro</span> <span style="color:rgb(0,0,0);">name</span><span style="color:rgb(92,92,92);">=</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">%axesData_i_h</span><span style="color:rgb(188,143,143);">"</span> <span style="color:rgb(50,185,185);">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);">%axesData_i_h.bin</span><span style="color:rgb(188,143,143);">"</span> <span style="color:rgb(0,0,0);">md5</span><span style="color:rgb(92,92,92);">=</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">e833d190e21b93af335a011ea9e76aef</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(92,92,92);">/</span><span style="color:rgb(92,92,92);">>
</span></pre>
        The MD5 hash is of the content of the .sci file, that here does
        not exist. It is use by genlib to check whether the .sci must be
        recompiled or not. You may try to set any md5 (or the cloned
        one). As long as you don't recompile the lib with genlib -- just
        loading it with load() or lib() --, this should work.<br>
        <br>
        My 2 cents..<br>
        <br>
        Samuel<br>
        <br>
        <br>
        Le 28/02/2018 à 14:52, Stéphane Mottelet a écrit :<br>
      </div>
      <blockquote cite="mid:c9fe6256-8946-0ff6-2a45-9a54a27ed485@utc.fr"
        type="cite">Hello, <br>
        <br>
        With the new library system, it is no longer possible to clone a
        function in a library. This feature is still documented in the
        help page of "lib" but is not working anymore since saving a
        user-defined scilab function uses the sod/hdf5 format. Maybe one
        can ask why such a feature is needed ? Sometimes it can be
        usefull to have a function which is callable by different names
        but actually does the same thing. The different calling names
        can come from the adaptation for different types of data, which
        can sometimes lead to the same treatment, hence to the same
        function. Instead of writing two functions with the same source
        code but a different calling name, cloning the original one was
        an interesting feature. <br>
        <br>
        I admit that the way it worked under scilab<6.x was not clean
        at all *but* officially documented in the "lib" help page. For
        example, imagine that a library has just been built (e.g. the
        plotlib...) <br>
        <br>
        genlib('plotlib','macros') <br>
        <br>
        I need to add to this library %axesData_i_h which is a clone of
        generic_i_h (in overloadinglib), which can be done in
        scilab<6.x by: <br>
        <br>
        %axesData_i_h=generic_i_h; <br>
        save('macros/%axesData_i_h.bin',%axesData_i_h) <br>
        mputl([mgetl('macros/names');'%axesData_i_h'],'macros/names') <br>
        <br>
        I said above "not clean at all", because the binary file
        "macros/lib" (which is created by the genlib call) does not need
        to be updated, as a subsequent <br>
        <br>
        plotlib=lib("macros") <br>
        <br>
        loads all functions, including %axesData_i_h <br>
        <br>
        <br>
        Doing things like this is not possible any more. It was was also
        to add persistent variables in libraries, with the same
        mechanism. <br>
        <br>
        By the way, under scilab 6.0.1, the "macros/lib" is now an XML
        file with a clear syntax, e.g. <br>
        <br>
        <?xml version="1.0" encoding="UTF-8" standalone="no"?> <br>
        <scilablib name="plotliblib"> <br>
          <macro name="%c_i_pltlibH" file="%c_i_pltlibH.bin"
        md5="d0966468b335a69681a29d84c99feb5c"/> <br>
          <macro name="%figureDa_i_h" file="%figureDa_i_h.bin"
        md5="a1ebda57a1607b28095def2e415e2ec1"/> <br>
        ... <br>
        </scilablib> <br>
        <br>
        It does not seem to be documented either. <br>
        <br>
        S. <br>
        <br>
        <br>
      </blockquote>
      <p><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>
    <p><br>
    </p>
    <pre class="moz-signature" cols="72">-- 
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
<a class="moz-txt-link-freetext" href="http://www.utc.fr/~mottelet">http://www.utc.fr/~mottelet</a></pre>
    <pre class="moz-signature" cols="72">-- 
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
<a class="moz-txt-link-freetext" href="http://www.utc.fr/~mottelet">http://www.utc.fr/~mottelet</a></pre>
  </body>
</html>