~ubuntu-branches/ubuntu/trusty/scilab/trusty

« back to all changes in this revision

Viewing changes to modules/dynamic_link/help/en_US/c_link.xml

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2012-08-02 11:02:49 UTC
  • mfrom: (1.4.6)
  • Revision ID: package-import@ubuntu.com-20120802110249-0v5953emkp25geuz
Tags: 5.4.0-beta-2-1~exp1
* New upstream release
* Remove libscilab-java (remove upstream). Use libscilab2-java instead.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
 *
13
13
 -->
14
14
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" version="5.0-subset Scilab" xml:id="c_link" xml:lang="en">
15
 
  <info>
16
 
    <pubdate>$LastChangedDate$</pubdate>
17
 
  </info>
18
15
  <refnamediv>
19
16
    <refname>c_link</refname>
20
17
    <refpurpose>check if symbol loaded with dynamic link</refpurpose>
22
19
  <refsynopsisdiv>
23
20
    <title>Calling Sequence</title>
24
21
    <synopsis>c_link(routine_name)
25
 
[test, ilib] = c_link(routine_name)
26
 
test = c_link(routine_name,num)</synopsis>
 
22
      [test, ilib] = c_link(routine_name)
 
23
      test = c_link(routine_name,num)
 
24
    </synopsis>
27
25
  </refsynopsisdiv>
28
26
  <refsection>
29
27
    <title>Arguments</title>
38
36
        <term>num</term>
39
37
        <listitem>
40
38
          <para>number of the shared library where routine_name is searched
41
 
          (-1: default, last used)</para>
 
39
            (-1: default, last used)
 
40
          </para>
42
41
        </listitem>
43
42
      </varlistentry>
44
43
      <varlistentry>
45
44
        <term>test</term>
46
45
        <listitem>
47
46
          <para>boolean, indicates if there is a shared library which contains
48
 
          <literal>routine_name</literal>.</para>
 
47
            <literal>routine_name</literal>.
 
48
          </para>
49
49
        </listitem>
50
50
      </varlistentry>
51
51
      <varlistentry>
52
52
        <term>ilib</term>
53
53
        <listitem>
54
54
          <para>a scalar, the number of the shared library which contains
55
 
          <literal>routine_name</literal></para>
 
55
            <literal>routine_name</literal>
 
56
          </para>
56
57
        </listitem>
57
58
      </varlistentry>
58
59
    </variablelist>
59
60
  </refsection>
60
61
  <refsection>
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>
 
63
    <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
    </para>
69
72
  </refsection>
70
73
  <refsection>
71
74
    <title>Examples (C code)</title>
72
75
    <programlisting role="example">if haveacompiler() then
73
 
  chdir(TMPDIR)
74
 
  f1=['int ext1c(int *n, double *a, double *b, double *c)'
75
 
    '{int k;'
76
 
    '  for (k = 0; k &lt; *n; ++k) '
77
 
    '      c[k] = a[k] + b[k];'
78
 
    '  return(0);}'];
79
 
 
80
 
  mputl(f1, TMPDIR + '/fun1.c');
81
 
  //creating the shared library (a gateway, a Makefile and a loader are
82
 
  //generated.
83
 
  ilib_for_link('ext1c','fun1.c',[],"c");
84
 
  // load the shared library
85
 
  exec loader.sce;
86
 
  // show link
87
 
  link('show')
88
 
 
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)
94
 
end
95
 
</programlisting>
 
76
      chdir(TMPDIR)
 
77
      f1=['int ext1c(int *n, double *a, double *b, double *c)'
 
78
      '{int k;'
 
79
      '  for (k = 0; k &lt; *n; ++k) '
 
80
      '      c[k] = a[k] + b[k];'
 
81
      '  return(0);}'];
 
82
      
 
83
      mputl(f1, TMPDIR + '/fun1.c');
 
84
      //creating the shared library (a gateway, a Makefile and a loader are
 
85
      //generated.
 
86
      ilib_for_link('ext1c','fun1.c',[],"c");
 
87
      // load the shared library
 
88
      exec loader.sce;
 
89
      // show link
 
90
      link('show')
 
91
      
 
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
      end
 
98
    </programlisting>
96
99
  </refsection>
97
100
  <refsection role="see also">
98
101
    <title>See Also</title>