contents   index   previous   next



Fortran OLE strings

 

Fortran OLE strings are dynamically allocated. The number of characters they hold can be changed at run time. A Fortran OLE String is actually a structure that holds the string, and a handle to the string:

 

type OLEString
        integer(OLECHAR_KIND),pointer::Str(:)
        integer(POINTER_KIND)::StrHndl
end type

 

Str() is a pointer to a vector of two-byte integers, allocated to accommodate the OLE string. StrHndl always has a pointer (a handle) to the first character in Str. You should not allocate/deallocate or change the content of a Fortran OLE String manually. Instead, you must use the functions and subroutines provided by f90VB to accomplish these tasks. For example, to create and initialize a Fortran OLE String to a literal, your program can do the following:

 

Type(OLEString)::MyOLEStr
Call OLEStrAlloc('My string',MyOLEStr)

 

Figure 1.6 shows the memory representation of a Fortran OLE String.