Go to the first, previous, next, last section, table of contents.


Link EB Library to Your Program

This chapter describes how to link EB Library to your program.

Compilation

EB Library consits of some header and library files. The header files are installed at `/usr/local/include/eb', if you have installed EB Library under `/usr/local', and if you have not change a directory for header files (includedir) at the installation.

Adding lines like the following at the beginning of your C program, the header files are included.

#include <eb/eb.h>
#include <eb/error.h>

We recommend you to include `eb/eb.h' rather than `eb.h'.

At compliation, you may have to give the `-I' option to the C compiler, in order to specify the location of the header files.

cc -I/usr/local/include -c sample.c

At linkage, you have to add the `-leb' and `-lz' options (`-lz' links zlib library) to the C compiler. You may also have to give the `-L' opions to the C compiler, in order to specify the location of EB Library and zlib. The library files are installed at `/usr/local/lib', if you have installed EB Library under `/usr/local', and if you have not change a directory for library files (libdir) at the installation.

Suppose that you have installed both EB Library and zlib library files at /usr/local/lib, the command line at linkage is like as this:

cc sample.o -L/usr/local/lib -leb -lz

For more details, please read the manuals for your C preprocessor, C compiler and linker.

Configuration

The header files in EB Library have some OS and site dependent features listed as below. You may have to configure your program about the features.

const
If the C compiler does not fully support the keyword const, define const to be empty, like this:
#define const 
If you are using Autoconf, add AC_C_CONST to your `configure.in'.
off_t
If off_t is not defined, define off_t to be long, like this:
#define off_t long
If you are using Autoconf, add AC_TYPE_OFF_T to your `configure.in'.
size_t
If size_t is not defined, define size_t to be unsigned, like this:
#define size_t unsigned
If you are using Autoconf, add AC_TYPE_SIZE_T to your `configure.in'.
ssize_t
If ssize_t is not defined, define ssize_t to be int, like this:
#define ssize_t int
If you are using Autoconf, add AC_CHECK_TYPE(ssize_t, int) to `configure.in'. If your `configure.in' contains AC_CONFIG_HEADER or AM_CONFIG_HEADER, also add the following lines to `acconfig.h':
/* Define to `int' if <sys/types.h> doesn't define.  */
#undef ssize_t

Character Code Issue

In CD-ROM books, books of the EBG format are written in ISO 8859-1, and others are written in JIS X 0208. EB Library API (Application Program Interface) uses ISO 8859-1 for EBG, but uses EUC-JP for other books, not JIS X 0208. When you give a Japanese string to an EB Library funftion as an argument, the string must be written in EUC-JP, and when you receive a Japanese string from an EB Library function, the string is written in EUC-JP.

However, the function eb_rawtext() doesn't follow the character code rule. It returns a string without any conversion.


Go to the first, previous, next, last section, table of contents.