gicExit(3) Initialize and uninitialize LibGIIGIC

Other Alias

gicInit

SYNOPSIS


#include <ggi/gic.h>
int gicInit(void);
int gicExit(void);

DESCRIPTION

gicInit initializes the library. This function must be called before using other LibGIIGIC functions; otherwise the results will be undefined.

gicExit uninitializes the library (after being initialized by gicInit) and automatically cleans up if necessary. This should be called after an application finished using the library. If any GIC functions are called after the library has been uninitialized, the results will be undefined.

gicInit allows multiple invocations. A reference count is maintained, and to completely uninitialize the library, gicExit must be called as many times as gicInit has been called beforehand.

RETURN VALUE

gicInit returns 0 for OK, otherwise an gii-error(3) code.

gicExit returns:

0
after successfully cleaning up,

>0
the number of 'open' gicInit calls, if there has been more than one call to gicInit. As gicInit and gicExit must be used in properly nested pairs, e.g. the first gicExit after two gicInit's will return 1.

<0
gii-error(3), especially if more gicExit calls have been done than gicInit calls.

EXAMPLES

Initialize and uninitialize LibGIIGIC:

if (gicInit() < 0) {
    fprintf(stderr, "Cannot initialize LibGIIGIC!\n");
    exit(1);
}
/* Do some LibGIIGIC stuff */
gicExit();