ggiInit(3ggi)

NAME
ggiInit, ggiExit - Initialize and uninitialize LibGGI

SYNOPSIS
#include <ggi/ggi.h>

int ggiInit(void);

int ggiExit(void); .SH "DESCRIPTION"

ggiInit initalizes the library. This function must be called before using other LibGGI functions; otherwise the results will be undefined.

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

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

RETURN VALUE

ggiInit returns 0 for OK, otherwise an error code.

ggiExit returns:

0   after successfully cleaning up,

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

< 0 error, especially if more ggiExit calls have been done than ggiInit calls.

EXAMPLES

  INITIALIZE AND UNINITIALIZE LIBGGI

if (ggiInit() < 0)
{
	fprintf(stderr, "Cannot initalize LibGGI!\n");
	exit(1);
}
/* Do some LibGGI stuff */
ggiExit();