OSF DCE Application Development Guide--Introduction and Style Guide

OSF DCE Application Development Guide—Introduction and Style Guide
The server output will look like this:
Array test 1
ab
Array test 2
a
b
c
d
e
Array test 3
subscript 3 value d
subscript 4 value e
subscript 5 value f
subscript 6 value g
Array test 4
subscript 4 value e
subscript 5 value f
subscript 6 value g
subscript 7 value h
subscript 8 value i
Note that for the last test, the declared structure contains a conformant and varying array.
The C language does not provide any intrinsic support for conformant arrays, and the
actual IDL-generated header declaration for the type cv_struct looks as follows:
typedef struct {
unsigned32 size;
unsigned32 first;
unsigned32 length;
idl_char array[1];
} cv_struct;
The declared structure contains an array only one element in length. When creating an
instance of this type, the application must allocate a data structure of the correct size,
either statically, as in the sample client code (the data item cv_array), or dynamically.
The recipient of such a data structure (in this case, the server manager code), can then
determine the actual size of the marshalled data by examining relevant field attribute
variables (in this case, the structure’s size member). Note also that IDL requires a
structure containing a conformant array to be passed by reference; that is, as a pointer
referent.
Conformant and varying arrays provide a way to pass blocks of contiguous data of
varying sizes and ranges. However, there is no intrinsic mechanism for passing sparse
arrays efficiently. Applications may, however, supply their own mechanisms for
compressing and passing large, sparse arrays using the [transmit_as] mechanism.
There are a number of complications that can arise when using arrays of pointers. For
example, an [out] or [in,out] conformant array of pointers, accompanied by an [out] or
[in,out] field attribute variable, could potentially be of any size when returned to a caller.
For [ref] pointers, which may not be NULL, the client must therefore ensure that all
possible returned pointers in such an array actually point to valid storage. You can easily
6 22 Tandem Computers Incorporated 124246