SafeArrayAllocData
f90VB Modules
f90VBDefs, f90VBSafeArrays
Summary
Allocates the memory for data-block based on a descriptor previously created with a call to SafeArrayAllocDescriptor.
Syntax
| subroutine SafeArrayAllocData | (SARef, iRet) |
| { | |
| integer(SAFEARRAY_KIND),intent(in):: | SARef | |
| type(FSafeArray),intent(in):: | SARef | |
| } | |
| integer(HRESULT_KIND),intent(out),optional:: | iRet |
Arguments
SARef [Input]
Can be either a handle or a Fortran Safe Array structure containing a handle to a previously allocated Safe Array descriptor.
iRet [Output/Optional]
Upon return, iRet contains S_OK or an error code. See comments for more information.
Comments
Before you call SafeArrayAllocData, you must have previously allocated the descriptor passed in argument SARef, and set the size for the elements of the arrays using SafeArraySetElementSize.
You do not need to call SafeArrayAllocData to allocate the data-block of an array created using SafeArrayCreate. SafeArrayCreate automatically allocates the memory for the array’s data.
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. | |
| E_UNEXPECTED | The array descriptor could not be locked. | |
| E_OUTOFMEMORY | Memory for the Safe Array data could not be allocated. | |
| E_INVALIDARG | One of the arguments is invalid. | |
Examples
See Example 2.4 (User Manual - Chapter 2).
Related Topics
| For information about: | See: | |
| Creating a Safe Array | SafeArrayCreate | |
| Destroying a Safe Array descriptor | SafeArrayDestroyDescriptor | |
| Allocating Safe Array descriptor | SafeArrayAllocDescriptor | |