Generalities
The LASH toolset is implemented in part as C libraries which can be linked to user applications. These applications should comply to the following guidelines:- The functions and datatypes provided by the toolset and used by an application must be declared in the code of this application. The package provides header files (*.h) containing the necessary declarations. These files can be included in the application code by means of the #include directive of the C preprocessor. The header files follow a naming convention: The name of the files that are intended to be included in user applications begin with lash (e.g., lash-ndd.h). For each library function or datatype, the header files that must necessarily be included in order to use this function or datatype are listed in its manual page.
- The function lash_init, which initializes LASH, must be called prior to calling any other package function. Similarly, the function lash_end, which shuts down the package, should be called before exiting the user application.
- The LASH package relies on the C malloc/free functions for managing dynamic memory. As a consequence, user applications should refrain from implementing memory allocation schemes that are not compatible with malloc/free. It should also be noted that objects allocated by LASH can only be freed by calling the appropriate LASH functions. Attempting to unallocate such an objet by calling the standard C library's free function would result in most cases in a memory leak.
- When compiling a user application, one should not forget to
specify the proper search directories for header files and for the library
object files. The header files of the core package are located in
the src/lash-core/ subdirectory of the main toolset directory.
There are two library object files related to the core package,
both located in the lib/ subdirectory:
- lash-core.o: main functions
- lash-arith.o: additional functions required by the NDD and the RVA packages
For instance, in order to compile my-prog.c with gcc, the directory in which LASH has been installed being /home/lash/, one can use the following command line:
gcc -I/home/lash/src/lash-core/ my-prog.c /home/lash/lib/lash-package.o
Datatypes
The following datatypes are provided by the core package:sint1, sint4, sint8 : Architecture-independent signed integers.
uint1, uint4, uint8 : Architecture-independent unsigned integers.
Functions
The following functions are provided by the core package:lash_init : Initializes the package.
lash_end : Shuts down the package.
lash_get_max_mem_usage, lash_get_mem_usage, lash_reset_max_mem_usage : Manage memory usage statistics.
lash_perror : Reports an error.
Variable
The following variable is provided by the core package:lash_errno : Most recent error code.