SafeArraySetBounds
f90VB Modules
f90VBDefs, f90VBSafeArrays
Summary
Sets the lower and upper bounds of a dimension in a Safe Array.
Syntax
| subroutine SafeArraySetBounds | (SARef, nDim, LBound, UBound iRet) |
| { | |
| integer(SAFEARRAY_KIND),intent(in):: | SARef | |
| type(FSafeArray),intent(in):: | SARef | |
| } | |
| integer(LONG_KIND),intent(in):: | nDim |
| integer(LONG_KIND),intent(in):: | LBound |
| integer(LONG_KIND),intent(in):: | UBound |
| integer(HRESULT_KIND),intent(out),optional:: | iRet |
Arguments
SARef [Input]
A handle to, or a Fortran Safe Array structure containing a handle to, an allocated Safe Array descriptor.
nDim [Input]
The array dimension for which to set the lower bound.
LBound, UBound [Input]
The value of lower and upper bounds respectively. UBound must be greater than LBound.
iRet [Output, Optional]
Upon return, iRet contains S_OK or an error code. See comments for more information.
Comments
Note that SARef must be a reference to an allocated Safe Array descriptor.
The bounds of a Safe Array dimension are defined using the lower bound and the number of elements in the dimension. This is different than the normal Fortran convention in which the bounds of an array dimension are defined using the lower and upper bounds. SafeArraySetBounds compute the number of elements in the dimension using the equation nElements = UBound – LBound +1.
The dimensions of the array must have been set before you can call SafeArraySetBounds.
You should never change the bounds of a Safe Array whose data block has been already allocated. This includes arrays created with SafeArrayCreate.
Argument iRet
Indicates success or failure of the subroutine. The following codes can be returned in this argument:
| Value returned in argument iRet | Description | |
| S_OK | Success. | |
| DISP_E_BADINDEX | The specified dimension is out of bounds. | |
| E_INVALIDARG | The item pointed to by SARef is not a Safe Array descriptor | |
Examples
See Example 2.4 (User Manual - Chapter 2).
Related Topics
| For information about | See | |
| Creating a Safe Array | SafeArrayCreate | |
| Obtaining the upper bound of an array dimension | SafeArrayGetUBound | |
| Obtaining the lower bound of an array dimension | SafeArrayGetLBound | |
| Obtaining the number of elements in an array dimension | SafeArrayGetNElements | |
| Allocating a Safe Array descriptor | SafeArrayAllocDescriptor | |
| Allocating Safe Array data | SafeArrayAllocData | |