17
17
areas in it are global and static.
19
19
Compile and link *.c and ../*.c with -DLIBRARY on the C compiler command
20
line, to compile Mathomatic in library mode, and to create the test
21
application which uses this API. This is automatically done by the make
22
utility input file "../makefile.lib". To compile the library and test
23
program, go to the Mathomatic build directory ("cd ..") and type:
20
line, to compile Mathomatic in library mode, and to create the test/example
21
application which uses this API. This is automatically done with the GNU
22
make utility and its input file "makefile". To compile the library and test
23
program, type "make" while in this "lib" directory.
28
25
This will create the API test executable named "mathomatic" and the static
29
26
library "libmathomatic.a". To run the test executable, type "./mathomatic".
30
27
To do a system install of the development library "libmathomatic.a" and C
31
28
header file "mathomatic.h", type:
33
sudo make -f makefile.lib install
35
Be sure to "make clean" again, before using a different makefile. Just
36
include the file "mathomatic.h" and call the functions in "lib.c" to use this
37
library. Link your program with "libmathomatic.a" by using "-lmathomatic
38
-lm" at the end of the ld linker command line. "libmathomatic.a" is not
39
required on the target system, since it is a static library, meaning it is
40
included in the resulting executable.
32
Just include the file "mathomatic.h" and call the functions in "lib.c" to use
33
this library. Link your program with "libmathomatic.a" by using
34
"-lmathomatic -lm" at the end of the ld linker command line.
35
"libmathomatic.a" is not required on the target system, since it is a static
36
library, meaning it is included in the resulting executable.
42
38
The following code provides a quick test of the library:
57
53
if (matho_process("x^2=4", &output) && output)
58
free((void *) output);
59
55
if (matho_process("solve x", &output)) {
61
57
printf("%s\n", output);
62
free((void *) output);
65
61
printf("%s\n", output);
68
64
The following Mathomatic commands are omitted in this library: calculate,
69
edit, plot, push, quit, and tally. GNU readline functionality is not used in
65
edit, "factor number", plot, push, quit, and tally. GNU readline
66
functionality is not used in the library.
72
68
Recently, the "nintegrate" and "integrate definite" commands are allowed; the
73
69
bounds of integration are specified in the two equation spaces following the