Home > Archive > Fortran > September 2005 > BSTR and Allocatable arrays
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
BSTR and Allocatable arrays
|
|
|
| All:
The BSTR (the Microsoft Visual C/C++ name, String in VB) stores its length
(like the Fortran allocatable array) but it can also be cast to an array of
two byte elements. Does the Fortran standard specify anything about how the
allocatable array is implemented in binary? Anyone how it appears in binary?
Regards from my planet.
David
| |
| Richard Maine 2005-09-28, 7:00 pm |
| In article <UbC_e.27679$nq.26765@lakeread05>,
"apm" <Contributor@AdsorptionProcessModeling.com> wrote:
> Does the Fortran standard specify anything about how the
> allocatable array is implemented in binary? Anyone how it appears in binary?
The Fortran standard doesn't specify how *ANYTHING* is implemented. THat
is fundamental to the standard. It just specifies what kinds of things
have to work. In practice, that often pretty much limits the
implementations, but that is still importantly different from the
standard actually specifying the implementation directly.
As to how allocatables are typically implemented (I'll ignore the "in
binary" part, because I can't fathom what it would mean. Certainly
nothing to do with base 2. I think you just mean how it is implemented
in the executable code, anyway...), an allocatable array pretty much
"has" to look just like any other array in order for everything to work
as specified in Fortran. That isn't a direct requirement of the
standard, but it is the "obvious" implementation and I know of no
exceptions in actual compilers.
Generally, (though not by requirement of the standard) an allocatable
array will be allocated in contiguous memory. There will be a separate
descriptor somewhere and that descriptor will have the address of the
allocatable, along with size information. Lower level details will vary.
| |
| Steve Lionel 2005-09-28, 7:00 pm |
| On Wed, 28 Sep 2005 15:31:02 -0400, "apm"
<Contributor@AdsorptionProcessModeling.com> wrote:
>The BSTR (the Microsoft Visual C/C++ name, String in VB) stores its length
>(like the Fortran allocatable array) but it can also be cast to an array of
>two byte elements. Does the Fortran standard specify anything about how the
>allocatable array is implemented in binary? Anyone how it appears in binary?
Just because a BSTR has a separate length that does not make it in any way
similar to a Fortran allocatable array. The Fortran standard says little if
nothing on the machine representation of an allocatable array, but even if it
did, that would not help you at all in accessing BSTRs.
Intel Visual Fortran and Compaq Visual Fortran (and perhaps other compilers)
provide routines for reading and writing BSTRs and SafeArrays. If you'd like
more pointers and an example, ask in our user forum (link below).
My recollection is that the data in a BSTR is UNICODE.
Steve Lionel
Software Products Division
Intel Corporation
Nashua, NH
User communities for Intel Software Development Products
http://softwareforums.intel.com/
Intel Fortran Support
http://developer.intel.com/software/products/support/
|
|
|
|
|