PreviousNext

Step 2: Declare Local Variables

The local variables session, result, and invoke_id are defined in the following code fragment from example.c:

int main(void)

{

DS_status error; /* return value from DS functions */

OM_return_code return_code;/* return value from OM functions */

OM_workspace workspace; /* workspace for objects */

OM_private_object session; /* session for directory operations*/

OM_private_object result; /* result of read operation */

OM_sint invoke_id; /* Invoke-ID of the read operation */

OM_value_position total_num; /* Number of Attribute Descriptors */

These data types are defined in a typedef statement in the xom.h header file. The session and result variables are defined as data type OM_private_object because they are returned by ds_bind( ) and ds_read( ), respectively, to the workspace as private objects. Because asynchronous operations (within the same thread) are not supported, the invoke_id functionality is redundant. The invoke_id parameter must be supplied to the XDS functions as described in the OSF DCE Application Development Reference , but its return value should be ignored.

Values in error and return_code are returned by XOM and XDS functions to indicate whether a call was successful. The workspace variable is defined as OM_workspace and is used when establishing an OM workspace. The total_num variable is defined as OM_value_position to indicate the number of attribute descriptors returned in the public object by om_get( ), based on the inclusion and exclusion parameters specified.