Initializing PEXlib


For and overview and related topics, see Introduction to PEXlib.

Initialize PEXlib by invoking the PEXInitialize function before invoking any PEXlib function which takes a display argument either explicitly, or implicitly, via the OC Context(1). The application must initialize PEX for each display connection that it plans to use; otherwise, results are undefined. Prior to PEXInitialize, the application only can invoke functions which do not take a display argument, either directly, or implicitly via the OC Context. Termination of PEXlib occurs implicitly at either program end or XCloseDisplay.

There are four other functions to call during initialization to determine what features and arguments are supported by each PEX server implementation. These functions are:

PEXGetImpDepConstants -
returns information about supported implementation-dependent constants

PEXGetEnumTypeInfo -
returns information about supported enumerated types.

PEXMatchRenderingTargets -
returns information about supported drawable types.

PEXGetExtensionInfo -
returns information about the PEX server extension such as the protocol version, vendor string, release number and subset support.

A client and a server extension can use different protocol levels (for example, a PEXlib 5.2 client might connect to a PEX server extension other than a PEX 5.2 server extension). However, different major revisions of the PEX protocol are not compatible with each other. If the major_version of the PEX extension's protocol is different than 5, then PEXlib 5.2 (or any version 5 of PEXlib) won't work with the PEX extension. A PEXlib 5.2 client works with a PEX extension that has a minor_version level of 2 or greater. If the minor_version level is 0 or 1, then only a subset of the function described in this PEXlib 5.2 specification is available. The program needs to check the minor_version field in the data structure returned by PEXInitialize or PEXGetExtensionInfo and avoid using functions that became part of PEXlib at minor versions greater than the value in the minor_version field. To assist the programmer in determining which PEX features are available for each minor version of the PEX protocol, this document marks each area of functionality with the protocol level in which it was introduced. Thus, if a feature is marked (5.1), then the feature is supported only with implementations that support protocol levels of PEX 5.1 or later. An implementation that supports PEX 5.0 (returns 0 in the minor_version field) does not support this function. If a feature is not marked, it is assumed to be supported in all levels of PEX.

Another function, the PEXGetSizeOCs utility function, determines the protocol formatted size of output commands. If the output command(s) plus the request header is larger than the maximum request size supported by a particular server (see XMaxRequestSize), then the server issues a BadLength error.


Footnotes

(1)
The OC Context is a new parameter passing mechanism introduced with PEXlib 5.2 and is described in greater detail later in this book (see PEXlib Output Command Context) In this discussion, it is sufficient to understand the OC Context as simply an alternate syntax for passing parameters to PEXlib.