XRINIT(3X)

NAME
XrInit - the Xrlib initialization function.

SYNOPSIS
#include <X/Xlib.h>
#include <Xr/Xrlib.h>

XrInit(allocFuncts)
xrAllocFuncts * allocFuncts;

DESCRIPTION
The XrInit() routine sets up Xrlib for use by an application by initializing internal data and adding a set of resources that the Xrlib routines need. It must be called before any Xrlib functionality is used and can only be called once.

The xrAllocFuncts parameter is a pointer to the following structure.
typedef struct
{
   char * (*newMalloc)();
   int    (*newFree)();
   char * (*newRealloc)();
   char * (*newCalloc)();
} xrAllocFuncts;

This structure contains the set of allocation functions that Xrlib routines should use for storage allocation. This set of function pointers only needs to be specified by application which want to provide their own storage management. All of the pointers must be supplied if any of the allocation functions are to be changed. The parameter should be set to NULL for applications which only want to use the default system allocation functions.

The set of function pointer contained within this structure are copied into a set of Xrlib globals variables. They are called xrMalloc, xrFree, xrRealloc, and xrCalloc. These variables are used by Xrlib functions which need storage allocation and can also be used by the application.

XrInit() also initializes the resource list with a set of resources. This includes resource types of XrTYPE_BITMAP, and XrTYPE_BITMAPID, Refer to the programmer's manual for specifics about the set of resources set up by XrInit().

RETURN VALUE
XrInit() returns TRUE when it is successful, FALSE otherwise.

ERROR CONDITIONS
If XrInit() returns FALSE the xrErrno global will be set to one of the following values.

xrErrno to be set to XrINVALIDPARM under the following conditions.

    XrInit() is called more than once.

SEE ALSO
XrGlobals(3X), XrResource(3X)