File: README

package info (click to toggle)
scilab 5.2.2-9
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 334,832 kB
  • ctags: 52,586
  • sloc: xml: 526,945; ansic: 223,590; fortran: 163,080; java: 56,934; cpp: 33,840; tcl: 27,936; sh: 20,397; makefile: 9,908; ml: 9,451; perl: 1,323; cs: 614; lisp: 30
file content (85 lines) | stat: -rw-r--r-- 2,619 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
Linking a .mexglx, say foo.mexglx, file with Scilab.
(Assuming foo.mexglx has been created by the Matlab's mex script).

0/ Here I create the file foo.mexglx using Scilab, just to have a 
   proper foo.mexglx for testing (note that I copy libfoo.so to foo.mexglx 
   but internally the name libfoo.so is contained in foo.mexglx and 
   the dynamic loader will search libfoo.so (see below)).

-->ilib_for_link("foo",['foo.o'],[],"c");
-->host('cp libfoo.so foo.mexglx');

   If I have matlab 

-->host('mex -V4 foo.c');

1/ If necessary, create empty libmx.so libmex.so and libmat.so which 
   could be required by the .mexglx file.
   (If "ldd foo.mexglx" shows a dependency). 

This is done by the following commands:

-->ilib_for_link("mx",[],[],"c");
-->ilib_for_link("mex",[],[],"c");
-->ilib_for_link("mat",[],[],"c");

2/link the (almost empty) .so files with Scilab

// Note that this is not really  usefull 
//-->link ./libmx.so;
//-->link ./libmex.so;
//-->link ./libmat.so;

3/link foo.mexglx with Scilab
-->link ./foo.mexglx;

4/ Make a dynamic library with the provided C routine (libtst.c file).
   Note that you can use libtst.c file as is and that the entrypoint 
   MUST BE mexFunction. If you have more than one mexglx files you 
   will need to copy libtst.c and change only the function name 
   (this is described below) 

-->ilib_for_link("tst",['libtst.o'],[],"c");

5/At Scilab prompt enter:

-->addinter('./libtst.so','libtst','foo');
OR addinter ./libtst.so libtst foo to link libtst.so with Scilab.
Note that foo is the name of the Scilab function.

6/call the mexfunction:
-->foo(5,'foo')

Note that the mexfunction is called through the libtst function
using the entrypoint 'libtst' (not mexFunction!).
If several mexFunction are used, one should build several 
libtst.c file, one for each mexfunction, using a different name
e.g. libtst1.c libtst2.c ... Each mexFunction must be called through a
different entrypoint. 

Here Makelib and libtst.c are generic files while
Makextimesy and libxtimesy.c are adapted to xtimesy.mexglx.

*********************************************

OR ...
ld -shared -o foo.so libtst.so foo.mexglx -rpath `pwd`
addinter('./foo.so','libtst','foo');

EXAMPLE:
mexname='xtimesy';
mputl(strsubst(mgetl('libtst.c'),'libtst',mexname),'lib'+mexname+'.c');
mputl(strsubst(mgetl('Makelib'),'libtst','lib'+mexname),'Make'+mexname);
//make -f Makextimesy
// ld -shared -o xtimesy.so libxtimesy.o xtimesy.mexglx -rpath `pwd`
//OR :
link ./libmx.so;
link ./libmex.so;
link ./libmat.so;
link ./xtimesy.mexglx;
addinter('./libxtimesy.so','xtimesy','xtimesy')
xtimesy(2,3)