<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>
On my side, with the following 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);">332cdd3297cdcb56652a3399056f02ed</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);">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);">332cdd3297cdcb56652a3399056f02ed</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>
it is possible to load the library, but then, first issue, only fun2
is reported:<br>
<font size="-1"><tt>--> lib ./</tt><tt><br>
</tt><tt> ans =</tt><tt><br>
</tt><tt>Functions files location : TMPDIR\test.<br>
<br>
</tt><tt></tt><tt>fun2 </tt></font><br>
<br>
And then, also in this case, calling fun2(1) crashes Scilab...<br>
<br>
<br>
</body>
</html>