Extension management
Name
ggiBltInit, ggiBltExit, ggiBltAttach, ggiBltDetach : Extension management
Synopsis
#include <ggi/blt.h> int ggiBltInit(void); int ggiBltExit(void); int ggiBltAttach(ggi_visual_t vis, ggiGA_resource_list *reqlist); int ggiBltDetach(ggi_visual_t vis);
Description
ggiBltInit initializes the library. This function must be called before using other LibGGIBlt functions; otherwise the results will be undefined.
ggiBltExit uninitializes the library (after being initialized by ggiBltInit) and automatically cleanup if necessary. This should be called after an application is finished with the library. If any LibGGIBlt 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.
ggiBltAttach extends a visual such that the LibBlt API may be used on the visual handle. This function must be called before using other LibGGIBlt functions on the visual handle. The parameter reslist is a pointer to a LibGAlloc resource list kept by the application, and such an object must exist and be passed here in order to use the simple-form ggiBltCreate* functions.
ggiBltDetach cleans up all state associated with using the LibGGIBlt API on this visual.
Return value
ggiBltInit, ggiBltAttach and ggiBltDetach return 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.
Example
Activate LibGGIBlt such that the ggiBltCreate* functions work:
ggiGA_resource_list reslist; reslist = NULL; ggiBltInit(); ggiBltAttach(vis, &reslist); /* Do some libblt stuff */ ggiBltDetach(vis); ggiBltExit();