Hello,
I have been working on a Fortran procedure to allocate a Fortran
allocatable array externally (meaning in C), rather then through the
native ALLOCATE.
At first I thought I would need access to all the array descriptors for
all the compilers I have and then have to work a lot to set them to the
correct values for the given allocation. But for the two compilers I
have access to that support the allocatable components TR extension (NAG
and Lahey), the array descriptor is the *same* for both allocatable
arrays and for array pointers. This made it very easy to design a
procedure C_ALLOCATE which can allocate these arrays externally (by
simply lying to the compiler about an external interface):
CALL C_ALLOCATE(CPTR=c_pointer, F_ALLOC=allocatable_array, SHAPE=shape,
STAT=alloc_status)
I would greatly appreciate any information on whether some compilers
implement different array descriptors for allocatable arrays and array
pointer. It seems to be most vendors would opt not to since it would
make their internal implementation more complicated, even though there
are some small benefits from having a different (more compact)
descriptor for the more restricted allocatable arrays.
Thanks,
Aleksandar
--
__________________________________
Aleksandar Donev
Complex Materials Theory Group (http://cherrypit.princeton.edu/)
Princeton Materials Institute & Program in Applied and Computational Mathematics
@ Princeton University
Address:
419 Bowen Hall, 70 Prospect Avenue
Princeton University
Princeton, NJ 08540-5211
E-mail: [log in to unmask]
WWW: http://atom.princeton.edu/donev
Phone: (609) 258-2775
Fax: (609) 258-6878
__________________________________
|