Initialize and uninitialize LibGG

Name

ggInit, ggExit : Initialize and uninitialize LibGG

Synopsis

#include <ggi/gg.h>

int ggInit();

int ggExit();

Description

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

ggExit uninitializes the library (after being initialized by ggInit) and automatically cleanup if necessary. This should be called after an application is finished with the library. If any GG functions are called after the library has been uninitialized, the results will be undefined.

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

These functions must only be called if neither libgii nor libggi is used. These libraries make use of libgg internally, so it will be properly initialized by giiInit(3) and ggiInit(3).

Return value

ggInit returns 0 for OK, otherwise an error code.

ggExit returns:

0

after successfully cleaning up,

>0

the number of open ggInit calls, if there has been more than one call to ggInit. As ggInit and ggExit must be used in properly nested pairs, e.g. the first ggExit after two giiInit(3)s will return 1.

<0

error, especially if more ggExit calls have been done than ggInit calls.