Table 2.2

 

Allowed combinations of vtType and FortranArray types for Automatic Safe Array creation

 

Type of Fortran Array elements

Allowed vtType

Type of the resulting Safe Array elements

Logical

 

Example of Fortran declaration:

Logical:: MyVector(100)

VT_BOOL

VT_BOOL[4]

 

Example of Automatic Safe Array creation:

Call SafeArrayCreate(SAHndl, VT_BOOL, MyVector)

Integer(kind=BYTE_KIND)

 

Example of Fortran declaration:

Integer(BYTE_KIND)::MyArray(5,5)

VT_U1, VT_I1

VT_U1 or VT_I1, depending on the value of vtType

 

Example of Automatic Safe Array creation:

Call SafeArrayCreate(SAHndl, VT_I1, MyArray)

Integer(kind=SHORT_KIND)

 

Example of Fortran declaration:

Integer(SHORT_KIND)::MyArray(5,5)

VT_U2, VT_I2

VT_U2 or VT_I2, depending on the value of vtType

 

Example of Automatic Safe Array creation:

Call SafeArrayCreate(SAHndl, VT_U2, MyArray)

Integer(kind=LONG_KIND)

 

Examples of Fortran declarations:

Integer(LONG _KIND)::MyArray(5,5)

Integer(BSTRHNDL_KIND)::MyVector(10)

 

VT_I4, VT_UI4, VT_BSTR, VT_ERROR, VT_INT, VT_UINT, VT_VOID, VT_HRESULT, VT_PTR, VT_LPSTR, VT_LPWSTR

VT_I4, VT_UI4, VT_BSTR, VT_ERROR, VT_INT, VT_UINT, VT_VOID, VT_HRESULT, VT_PTR, VT_LPSTR, or VT_LPWSTR, depending on the value of vtType

 

 

Example of Automatic Safe Array creation:

Call SafeArrayCreate(SAHndl, VT_I4, MyArray)

 

Call SafeArrayCreate(SAHndl, VT_BSTR, MyVector)

 

Real(kind=FLOAT_KIND)

 

Example of Fortran declaration:

Real(FLOAT_KIND)::MyArray(10,5)

VT_R4

VT_R4

 

Example of Automatic Safe Array creation:

Call SafeArrayCreate(SAHndl, VT_R4, MyArray)

Real(kind=DOUBLE_KIND)

 

Example of Fortran declaration:

Real(FLOAT_KIND)::MyArray(10,5)

Real(DATE_KIND)::MyVector(10)

VT_R8, VT_DATE

VT_R8 or VT_DATE, depending on the value of vtType

 

Example of Automatic Safe Array creation:

Call SafeArrayCreate(SAHndl, VT_R8, MyArray)

 

Call SafeArrayCreate(SAHndl, VT_DATE, MyVector)

Character(len=*)

 

Example of Fortran declaration:

character(100)::MyVector(12)

 

VT_BSTR, VT_LPWSTR

VT_BSTR

 

Example of Automatic Safe Array creation:

Call SafeArrayCreate(SAHndl, VT_BSTR, MyVector)

Type(VARIANT)

 

Example of Fortran declaration:

Type(VARIANT)::MyVector(12)

VT_VARIANT

VT_VARIANT

 

Example of Automatic Safe Array creation:

Call SafeArrayCreate(SAHndl, VT_VARIANT, MyVector)

 

 

 

 

 

 

 

Table Notes:

4. Note that VT_BOOL is a two-byte type, while Fortran compilers usually use only one byte for logical variables.