Using Arrays of Variable Sizes with the DCOM Wrapper

This document covers the following topics:


Description

The following describes an array without fixed size and with strings of variable length. It is sent from client to server and vice versa. The number of strings sent from client to server and from server to client can differ.

Software AG IDL File

Library 'Arrays' Is
 Program 'FirstArray'
     1 Names (AV / V) In Out

Visual Basic Example

Dim names As String
Redim mynames(3)
Set obj = CreateObject("EOL.ArrayExample")
 obj.FirstArray mynames

To retrieve the list of mynames, first get the boundaries of the returning array; then you can access it.

For more information, see the Visual Basic documentation.

Methods for Arrays of Variable Sizes

Attributes defined inside a group in the Software AG IDL file are accessed via properties (as in the previous version). To use arrays of variable sizes, two methods were added: get and redim.

Software AG IDL File

Library 'Arrays' Is
 Program 'FirstArray'
   1 PhoneEntry
   2 Names               (AV)  In Out
     2 PhoneNumber  (AV/V) In Out

Array of a Group with Variable Size on Level 1 in the IDL File

  redim_<program name>_<name>( LONG newSize,
                              LONG whichDimension,
                              LONG index1,
                              LONG index2,
                              LONG index3 )
  get_<program name>_Bounds   (
                              LONG* lowerBoundary,
                              LONG* upperBoundary,
                              LONG whichDimension,
                              LONG index1,
                              LONG index2,
                              LONG index3 )
  LONG get_<program name>_LowerBound   (
                              LONG whichDimension,
                              LONG index1,
                              LONG index2,
                              LONG index3 )
  LONG get_<program name>_UpperBound   (
                              LONG whichDimension,
                              LONG index1,
                              LONG index2,
     LONG index3 )

Otherwise

  redim_<name>( LONG newSize,
                              LONG whichDimension,
                              LONG index1,
                              LONG index2,
                              LONG index3 )
  get_<name>_Bounds(
                              LONG* lowerBoundary,
                              LONG* upperBoundary,
                              LONG whichDimension,
                              LONG index1,
                              LONG index2,
                              LONG index3 )
  LONG get_<name>_LowerBound   (
                              LONG whichDimension,
                              LONG index1,
                              LONG index2,
                              LONG index3 )
  LONG get_<name>_UpperBound   (
                              LONG whichDimension,
                              LONG index1,
                              LONG index2,
                              LONG index3 )

Use redim to increase or reduce the number of elements in an array. In a multi-dimensional array you can use the indices to modify a subarray.

Group Definition for Arrays of Variable Sizes

Library 'Arrays' Is
 Program 'ThirdArray'
   1 User      (V)
   2 Names     (AV)
   2 Uid       (AV)

Groups with arrays of variable sizes are handled like normal groups using the methods get and redim:

redim_[<program name>_]<groupname>

and

get_[<program name>_]<groupname>_bounds.