[Scilab-users] Clone a function, continued
Samuel Gougeon
sgougeon at free.fr
Wed Feb 28 17:21:09 CET 2018
Le 28/02/2018 à 16:30, Stéphane Mottelet a écrit :
> Thanks Samuel, the problem is that
>
> save('macros/%axesData_i_h.bin', '%axesData_i_h')
>
> 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 :
>
> path=TMPDIR+'/test/';
> mkdir(path)
> mputl('function y=fun1(x), y=x, end',path+'fun1.sci');
> genlib('test',path)
> save(path+'fun1.sod','fun1')
> doc=xmlRead(path+'lib');
> doc.root.children(1).attributes.file='fun1.sod';
> disp(xmlDump(doc))
> xmlWrite(doc,path+'lib');
> clear
> lib(TMPDIR+'/test/')
>
> The following output is obtained:
>
> !<?xml version="1.0" encoding="UTF-8"
> standalone="no"?> !
> ! !
> !<scilablib name="test"> !
> ! !
> ! <macro name="fun1" file="fun1.sod"
> md5="a50d8a8cda2cd6036306e08e61ffcbeb"/> !
> ! !
> !</scilablib> !
>
> Emplacement des fichiers des fonctions : /.
>
> fun1
>
> -->
>
> Unfortunately, calling fun1 crashes scilab...
On my side, with the following lib file:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<scilablib name="testlib">
<macro name="fun1" file="fun1.bin" md5="332cdd3297cdcb56652a3399056f02ed"/>
<macro name="fun2" file="fun1.bin" md5="332cdd3297cdcb56652a3399056f02ed"/>
</scilablib>
it is possible to load the library, but then, first issue, only fun2 is
reported:
--> lib ./
ans =
Functions files location : TMPDIR\test.
fun2
And then, also in this case, calling fun2(1) crashes Scilab...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20180228/a67d2b0c/attachment.htm>
More information about the users
mailing list