Context management functions handle the allocation, initialization, and destruction of context variables (variables of type OSCTXT). These variables hold all of the working data used during the process of encoding or decoding a message. The context provides thread safe operation by isolating what would otherwise be global variables within this structure. The context variable is passed from function to function as a message is encoded or decoded and maintains state information on the encoding or decoding process.
The main functions in this group that a user should be aware of are the following:
rtxInitContext - This is the first function that must be called to initialize a context block structure before it can be used as an argument in subsequent function calls. This function initializes all internal variables within the context to their start values.
rtxInitContextBuffer - This function associates a memory buffer with a context. This memory buffer can be used to as the target for encoding an XML message or as the source to read from for decoding a message.
rtxFreeContext - This function is used to free all working memory held within the context. All memory allocation done using memory management functions are tracked within the context. All of this memory can be released at once by calling this function. It should be the last function called when all work using a particular context variable is complete.
Other functions exist for doing further operations on contexts including copying and setting data within. A full description of all context management functions can be found in the XBinder C/C++ Runtime Reference Manual.