<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Le 28/02/2018 à 16:30, Stéphane
Mottelet a écrit :<br>
</div>
<blockquote cite="mid:6613d71e-24e3-713b-a861-2c46802ff5ac@utc.fr"
type="cite">
<meta http-equiv="content-type" content="text/html;
charset=windows-1252">
<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...</div>
</blockquote>
<br>
Last trial for today:<br>
<ul>
<li>Define fun1() in fun1.sci.</li>
<li>Compile fun1.sci with genlib(): OK => fun1.bin available</li>
<li>Create fun2.bin as a hard link to fun1.bin:<br>
<tt>host("mklink /H fun2.bin fun1.bin") // Windows<br>
</tt></li>
<li>Update (by hand or code, not with genlib) 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);">?xml</span> <span style="color:rgb(0,0,0);">version</span><span style="color:rgb(92,92,92);">=</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">1.0</span><span style="color:rgb(188,143,143);">"</span> <span style="color:rgb(0,0,0);">encoding</span><span style="color:rgb(92,92,92);">=</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">UTF-8</span><span style="color:rgb(188,143,143);">"</span> <span style="color:rgb(0,0,0);">standalone</span><span style="color:rgb(92,92,92);">=</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">no</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">?</span><span style="color:rgb(92,92,92);">></span>
<span style="color:rgb(92,92,92);"><</span><span style="color:rgb(0,0,0);">scilablib</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);">testlib</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><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);">fun1</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);">fun1.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);">8a3737878c543f1a5005c42122236628</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>
<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);">fun2</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);">fun2.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);">8a3737878c543f1a5005c42122236628</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>
<span style="color:rgb(92,92,92);"><</span><span style="color:rgb(92,92,92);">/</span><span style="color:rgb(0,0,0);">scilablib</span><span style="color:rgb(92,92,92);">>
</span></pre>
</li>
<li>load the library (OK : both fun1 and fun2 are loaded):<br>
<font size="-1"><tt>--> lib ./</tt><tt><br>
</tt><tt> ans =</tt><tt><br>
</tt><tt>Functions files location : TMPDIR\test.</tt><tt><br>
</tt><tt>fun1 fun2 </tt><tt><br>
</tt><tt><br>
</tt></font></li>
<li><font size="-1"><tt>fun1(1) //=> OK</tt></font></li>
<li><font size="-1"><tt>fun2(1) // .... => crash</tt></font></li>
</ul>
<p>A bad end.<br>
It is likeky vain to go on fighting without Antoine Elias advices
and comments :)</p>
Samuel<br>
<br>
</body>
</html>