40
38
<para>number of the shared library where routine_name is searched
41
(-1: default, last used)</para>
39
(-1: default, last used)
47
46
<para>boolean, indicates if there is a shared library which contains
48
<literal>routine_name</literal>.</para>
47
<literal>routine_name</literal>.
54
54
<para>a scalar, the number of the shared library which contains
55
<literal>routine_name</literal></para>
55
<literal>routine_name</literal>
61
62
<title>Description</title>
62
<para><literal>c_link</literal> is a boolean function which checks if the
63
routine <literal>routine_name</literal> is currently linked. This function
64
returns a boolean value true or false. When used with two return values,
65
the function <literal>c_link</literal> returns a boolean value in
66
<literal>test</literal> and the number of the shared library which
67
contains <literal>routine_name</literal> in <literal>ilib</literal> (when
68
<literal>test</literal> is true).</para>
64
<literal>c_link</literal> is a boolean function which checks if the
65
routine <literal>routine_name</literal> is currently linked. This function
66
returns a boolean value true or false. When used with two return values,
67
the function <literal>c_link</literal> returns a boolean value in
68
<literal>test</literal> and the number of the shared library which
69
contains <literal>routine_name</literal> in <literal>ilib</literal> (when
70
<literal>test</literal> is true).
71
74
<title>Examples (C code)</title>
72
75
<programlisting role="example">if haveacompiler() then
74
f1=['int ext1c(int *n, double *a, double *b, double *c)'
76
' for (k = 0; k < *n; ++k) '
77
' c[k] = a[k] + b[k];'
80
mputl(f1, TMPDIR + '/fun1.c');
81
//creating the shared library (a gateway, a Makefile and a loader are
83
ilib_for_link('ext1c','fun1.c',[],"c");
84
// load the shared library
89
[test, ilib] = c_link('ext1c') // check if 'ext1c' symbol is linked in scilab (it returns %T, ilib equals to 0)
90
c_link('ext1c', -1) // check if 'ext1c' linked in scilab in current library (last used) (it returns %T)
91
c_link('ext1c', 0) // check in library (id eqs 0) if 'ext1c' is linked (it returns %T)
92
c_link('ext1c', 1) // 'ext1c' not in library with id = 1 (it returns %F)
93
c_link('toto') // returns %F 'toto' not linked to scilab (it returns %F)
77
f1=['int ext1c(int *n, double *a, double *b, double *c)'
79
' for (k = 0; k < *n; ++k) '
80
' c[k] = a[k] + b[k];'
83
mputl(f1, TMPDIR + '/fun1.c');
84
//creating the shared library (a gateway, a Makefile and a loader are
86
ilib_for_link('ext1c','fun1.c',[],"c");
87
// load the shared library
92
[test, ilib] = c_link('ext1c') // check if 'ext1c' symbol is linked in scilab (it returns %T, ilib equals to 0)
93
c_link('ext1c', -1) // check if 'ext1c' linked in scilab in current library (last used) (it returns %T)
94
c_link('ext1c', 0) // check in library (id eqs 0) if 'ext1c' is linked (it returns %T)
95
c_link('ext1c', 1) // 'ext1c' not in library with id = 1 (it returns %F)
96
c_link('toto') // returns %F 'toto' not linked to scilab (it returns %F)
97
100
<refsection role="see also">
98
101
<title>See Also</title>