When a fatal error occurs, an error message is output to the standard error
output stream, and the function cl_abort
is called. The default
version of this function (provided in the library) terminates the application.
To catch such a fatal error, you need to define the function cl_abort
yourself, with the prototype
#include <cl_abort.h> void cl_abort (void);
This function must not return control to its caller.
Floating point underflow denotes the situation when a floating-point number
is to be created which is so close to 0
that its exponent is too
low to be represented internally. By default, this causes a fatal error.
If you set the global variable
cl_boolean cl_inhibit_floating_point_underflow
to cl_true
, the error will be inhibited, and a floating-point zero
will be generated instead. The default value of
cl_inhibit_floating_point_underflow
is cl_false
.
The output of the function fprint
may be customized by changing the
value of the global variable cl_default_print_flags
.
Every memory allocation of CLN is done through the function pointer
cl_malloc_hook
. Freeing of this memory is done through the function
pointer cl_free_hook
. The default versions of these functions,
provided in the library, call malloc
and free
and check
the malloc
result against NULL
.
If you want to provide another memory allocator, you need to define
the variables cl_malloc_hook
and cl_free_hook
yourself,
like this:
#include <cl_malloc.h> void* (*cl_malloc_hook) (size_t size) = ...; void (*cl_free_hook) (void* ptr) = ...;
The cl_malloc_hook
function must not return a NULL
pointer.
It is not possible to change the memory allocator at runtime, because it is already called at program startup by the constructors of some global variables.
Go to the first, previous, next, last section, table of contents.