13
13
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="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="compile_and_run_call_scilab" xml:lang="en">
15
<refname>Compile and run with Call Scilab</refname>
16
<refpurpose>How to compile a native application based on or using
21
<title>Compilation</title>
22
<para>To compile a native code based on Call Scilab, it is necessary to
23
define some arguments, variables and paths.
27
<para>CFLAGS. Call Scilab needs to have access to the headers of
28
Scilab core and call Scilab module.
32
<para>Linux/Unix/MacOSX:</para>
35
<para>In the binary version of Scilab, CFLAGS must be set to
36
/path/to/scilab/include/scilab/core/ and
37
/path/to/scilab/include/scilab/call_scilab/
41
<para>In the source tree of Scilab, CFLAGS must be set to
42
/path/to/scilab/modules/core/includes/ and
43
/path/to/scilab/modules/call_scilab/includes/
54
<para>LD_LIBRARY_PATH - Paths to libscilab.so and libjavasci.so (or
59
<para>Linux/Unix/MacOSX:</para>
62
<para>In the binary version of Scilab, SCI will point to
63
/path/to/scilab/lib/scilab/
67
<para>In the source tree of Scilab, SCI will point to the root
68
of the source tree /path/to/scilab/modules/call_scilab/.libs/
69
and /path/to/scilab/.libs/
77
<para>LDFLAGS - The name of the library to link against</para>
80
<para>Linux/Unix/MacOSX: It is only mandatory to link against
81
scilab. This should include the other libraries.
87
<para>The following example is a Makefile to build against Scilab binary</para>
88
<programlisting role="example"><![CDATA[
15
<refname>Compile and run with Call Scilab</refname>
16
<refpurpose>How to compile a native application based on or using
21
<title>Compilation</title>
22
<para>To compile a native code based on Call Scilab, it is necessary to
23
define some arguments, variables and paths.
27
<para>CFLAGS. Call Scilab needs to have access to the headers of
28
Scilab core and call Scilab module.
32
<para>Linux/Unix/MacOSX:</para>
35
<para>In the binary version of Scilab, CFLAGS must be set to
36
/path/to/scilab/include/scilab/core/ and
37
/path/to/scilab/include/scilab/call_scilab/
41
<para>In the source tree of Scilab, CFLAGS must be set to
42
/path/to/scilab/modules/core/includes/ and
43
/path/to/scilab/modules/call_scilab/includes/
54
<para>LD_LIBRARY_PATH - Paths to libscilab.so and libjavasci.so (or
59
<para>Linux/Unix/MacOSX:</para>
62
<para>In the binary version of Scilab, SCI will point to
63
/path/to/scilab/lib/scilab/
67
<para>In the source tree of Scilab, SCI will point to the root
68
of the source tree /path/to/scilab/modules/call_scilab/.libs/
69
and /path/to/scilab/.libs/
77
<para>LDFLAGS - The name of the library to link against</para>
80
<para>Linux/Unix/MacOSX: It is only mandatory to link against
81
scilab. This should include the other libraries.
87
<para>The following example is a Makefile to build against Scilab binary</para>
88
<programlisting role="example"><![CDATA[
89
89
# A sample Makefile building a C code using Call Scilab using Scilab binary
90
90
PATH_SCILAB = /path/to/scilab/
91
91
# Note that PATH_SCILAB can be /usr/ is using a packaged version of Scilab.
98
98
export LD_LIBRARY_PATH=$(PATH_TO_LIB_SCILAB):$(PATH_TO_LIB_CALL_SCILAB)
99
99
gcc -o myExample $(SCILAB_LDFLAGS) -L$(PATH_TO_LIB_SCILAB) -L$(PATH_TO_LIB_CALL_SCILAB) $(SCILAB_CFLAGS) simple_call_scilab.c
100
100
]]></programlisting>
101
<para>The following example is a Makefile to build against Scilab source tree</para>
102
<programlisting role="example"><![CDATA[
101
<para>The following example is a Makefile to build against Scilab source tree</para>
102
<programlisting role="example"><![CDATA[
103
103
# A sample Makefile building a C code using Call Scilab using Scilab built in it source tree.
104
104
PATH_SCILAB = /path/to/scilab/sources/
105
105
SCILAB_CFLAGS = -I$(PATH_SCILAB)/modules/core/includes/ -I$(PATH_SCILAB)/modules/call_scilab/includes/
111
111
export LD_LIBRARY_PATH=$(PATH_TO_LIB_SCILAB):$(PATH_TO_LIB_CALL_SCILAB)
112
112
gcc -o myExample $(SCILAB_LDFLAGS) -L$(PATH_TO_LIB_SCILAB) -L$(PATH_TO_LIB_CALL_SCILAB) $(SCILAB_CFLAGS) simple_call_scilab.c
113
113
]]></programlisting>
116
<title>Running</title>
117
<para>To run an application based on Call Scilab, there are a few other
120
<para>Some global variables must me set:</para>
123
<para>SCI - Path to Scilab files</para>
126
<para>Linux/Unix/MacOSX:</para>
129
<para>In the binary version of Scilab, SCI will point to
130
/path/to/scilab/share/scilab/
134
<para>In the source tree of Scilab, SCI will point to the root
135
of the source tree /path/to/scilab/source/tree/
141
<para>Windows:</para>
146
<para>LD_LIBRARY_PATH - Paths to libscilab.so and libjavasci.so (or
151
<para>Linux/Unix/MacOSX:</para>
154
<para>In the binary version of Scilab, SCI will point to
155
/path/to/scilab/lib/scilab/
159
<para>In the source tree of Scilab, SCI will point to the root
160
of the source tree /path/to/scilab/modules/javasci/.libs/ and
161
/path/to/scilab/.libs/
169
<para>LD_LIBRARY_PATH (Java) - Paths to Java native libraries
170
(libjava.so, libjvm.so, libhpi.so)... It is usually provided by the
171
operating system or by Scilab distribution. Please note that won't be
172
necessary in Scilab 5.2
176
<para>Linux/Unix:</para>
179
<para>JAVA_HOME/jre/lib/<arch>/,
180
JAVA_HOME/jre/lib/<arch>/server,
181
JAVA_HOME/jre/lib/<arch>/native_threads/ (<arch>
188
<para>Mac OS X:</para>
196
<para>Note that two environnement variables are taken in account for
202
<literal>SCI_DISABLE_TK=1</literal> Disables Tk (Tcl's
208
<literal>SCI_JAVA_ENABLE_HEADLESS=1</literal> Launch Java in
209
headless mode (no AWT/Swing)
215
<title>Examples</title>
216
<programlisting role="example"><![CDATA[
116
<title>Running</title>
117
<para>To run an application based on Call Scilab, there are a few other
120
<para>Some global variables must me set:</para>
123
<para>SCI - Path to Scilab files</para>
126
<para>Linux/Unix/MacOSX:</para>
129
<para>In the binary version of Scilab, SCI will point to
130
/path/to/scilab/share/scilab/
134
<para>In the source tree of Scilab, SCI will point to the root
135
of the source tree /path/to/scilab/source/tree/
141
<para>Windows:</para>
146
<para>LD_LIBRARY_PATH - Paths to libscilab.so and libjavasci.so (or
151
<para>Linux/Unix/MacOSX:</para>
154
<para>In the binary version of Scilab, SCI will point to
155
/path/to/scilab/lib/scilab/
159
<para>In the source tree of Scilab, SCI will point to the root
160
of the source tree /path/to/scilab/modules/javasci/.libs/ and
161
/path/to/scilab/.libs/
169
<para>LD_LIBRARY_PATH (Java) - Paths to Java native libraries
170
(libjava.so, libjvm.so, libhpi.so)... It is usually provided by the
171
operating system or by Scilab distribution. Please note that won't be
172
necessary in Scilab 5.2
176
<para>Linux/Unix:</para>
179
<para>JAVA_HOME/jre/lib/<arch>/,
180
JAVA_HOME/jre/lib/<arch>/server,
181
JAVA_HOME/jre/lib/<arch>/native_threads/ (<arch>
188
<para>Mac OS X:</para>
196
<para>Note that two environnement variables are taken in account for
202
<literal>SCI_DISABLE_TK=1</literal> Disables Tk (Tcl's
208
<literal>SCI_JAVA_ENABLE_HEADLESS=1</literal> Launch Java in
209
headless mode (no AWT/Swing)
215
<title>Examples</title>
216
<programlisting role="example"><![CDATA[
217
217
# Serie of declarations to execute my binary.
219
219
# With a Scilab source tree:
237
237
]]></programlisting>
239
<refsection role="see also">
240
<title>See Also</title>
241
<simplelist type="inline">
243
<link linkend="api_scilab">api Scilab</link>
246
<link linkend="call_scilab">call_scilab</link>
249
<link linkend="StartScilab">StartScilab</link>
252
<link linkend="SendScilabJob">SendScilabJob</link>
255
<link linkend="SendScilabJobs">SendScilabJobs</link>
258
<link linkend="DoubleManagement_callscilab">Double Management</link>
261
<link linkend="BooleanManagement_callscilab">Boolean Management</link>
264
<link linkend="ComplexManagement_callscilab">Complex Management</link>
267
<link linkend="StringManagement_callscilab">String Management</link>
239
<refsection role="see also">
240
<title>See Also</title>
241
<simplelist type="inline">
243
<link linkend="api_scilab">api Scilab</link>
246
<link linkend="call_scilab">call_scilab</link>
249
<link linkend="StartScilab">StartScilab</link>
252
<link linkend="SendScilabJob">SendScilabJob</link>
255
<link linkend="SendScilabJobs">SendScilabJobs</link>
258
<link linkend="DoubleManagement_callscilab">Double Management</link>
261
<link linkend="BooleanManagement_callscilab">Boolean Management</link>
264
<link linkend="ComplexManagement_callscilab">Complex Management</link>
267
<link linkend="StringManagement_callscilab">String Management</link>