| 1 |
|
| 2 |
|
| 3 |
This file provides instructions on how to compile and link your programs with |
| 4 |
the library. You could link C or C++ programs with the library. |
| 5 |
|
| 6 |
The package will install library libiml.a and header file iml.h in the target |
| 7 |
machine. To link with the library, you need to locate the package directory |
| 8 |
as well as GMP and CBLAS (ATLAS by default) directories. |
| 9 |
|
| 10 |
Suppose |
| 11 |
compiler is CC, |
| 12 |
this package header file is in directory <iml-include-dir>, |
| 13 |
this package library is in directory <iml-lib-dir>, |
| 14 |
GMP header file is in directory <gmp-include-dir>, |
| 15 |
GMP library is in directory <gmp-lib-dir>, |
| 16 |
CBLAS header file is in directory <cblas-include-dir>, |
| 17 |
CBLAS library is in directory <cblas-lib-dir>, |
| 18 |
linker flags needed to link to CBLAS are <cblas-linker-flags>. |
| 19 |
|
| 20 |
Header Include |
| 21 |
============== |
| 22 |
|
| 23 |
In the source code of your program, you should include both "gmp.h" and |
| 24 |
"iml.h" like this: |
| 25 |
|
| 26 |
#include "gmp.h" |
| 27 |
#include "iml.h" |
| 28 |
|
| 29 |
It is important to put "gmp.h" ahead of "iml.h" since iml.h uses symbols |
| 30 |
defined in GMP. |
| 31 |
|
| 32 |
|
| 33 |
Header Options |
| 34 |
============== |
| 35 |
|
| 36 |
If the header files are not installed in the default search path, which is |
| 37 |
usually /usr or /usr/local, you should add one more of the following options |
| 38 |
|
| 39 |
-I<iml-include-dir>, -I<cblas-include-dir>, -I<gmp-include-dir> |
| 40 |
|
| 41 |
|
| 42 |
Linking |
| 43 |
======= |
| 44 |
|
| 45 |
Your program must have the following linking flags |
| 46 |
|
| 47 |
-liml <cblas-linker-flags> -lgmp |
| 48 |
|
| 49 |
It is important to put flag -liml ahead of other three flags. |
| 50 |
If ATLAS is used, then <cblas-linker-flags> should be "-lcblas -latlas" |
| 51 |
Note that it is also important to put -lcblas ahead of -latlas. |
| 52 |
|
| 53 |
If the libraries are not installed in the default search path, you should add |
| 54 |
one or more of the following options |
| 55 |
|
| 56 |
-L<iml-lib-dir> -L<cblas-lib-dir> -L<gmp-lib-dir> |
| 57 |
|
| 58 |
Overall, you could use the following way to compile and link your program with |
| 59 |
this library: |
| 60 |
|
| 61 |
CC [-I<iml-include-dir> -I<cblas-include-dir> -I<gmp-include-dir>] |
| 62 |
yourprogram.c [-o yourprogram] |
| 63 |
[-L<iml-lib-dir> -L<cblas-lib-dir> -L<gmp-lib-dir>] |
| 64 |
-liml <cblas-linker-flags> -lgmp |
| 65 |
|
| 66 |
|
| 67 |
icc compiler |
| 68 |
============= |
| 69 |
|
| 70 |
If you compile C programs using icc, you might need add another linker flag |
| 71 |
-no_cpprt. Otherwise, the linker might link with a run time C++ library and |
| 72 |
end up with an error message. |
| 73 |
|
| 74 |
|
| 75 |
Use the Library in C++ |
| 76 |
====================== |
| 77 |
|
| 78 |
If you want to call the library functions from C++ programs, you need to |
| 79 |
include the package header file in the following way |
| 80 |
|
| 81 |
extern "C" |
| 82 |
{ |
| 83 |
#include "iml.h" |
| 84 |
} |