ggiBltInit

Name

ggiBltInit, ggiBltExit -- Initialize and uninitialize LibBlt

Synopsis

#include <ggi/blt.h>

int ggiBltInit(void);

int ggiBltExit(void);

Description

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

ggiBltExit uninitializes the library (after being initalized by ggiBltInit) and automatically cleans up if necessary. This should be called after an application is finished with the library. If any LibBlt functions are called after the library has been uninitialized, the results will be undefined.

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

Return value

ggiBltInit returns 0 for OK, otherwise an error code.

ggiBltExit returns:

0

after successfully cleaning up,

> 0

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

< 0

error, especially if more ggiBltExit calls have been done than ggiBltInit calls.

Examples

Example 1. Initialize and uninitialize LibBlt

if (!ggiBltInit())
{
        exit(EXIT_FAILURE);  /* can't start! */
}

/* Do some libblt stuff */

ggiBltExit();