- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
I am creating an allocatable array and filling an array with data.
type ObsType
character p*8
integer*4 x,y,z
character desc*32
end type ObsType
common/Obsc/Obs/ObsTot
integer*4 ObsTot
type (ObsType),allocatable :: Obs(:)
allocate (Obs(ObsTot))
I then want to use this data in a subrourine and in the subroutine repeat the type & common definition bove.
Is this the correct way to go about it as I am getting compile errors,
the first is "This COMMON scalar or array is invalid in this context" on the allocatable line,
or cannot you not use allocatable arrays in subroutines?
David
type ObsType
character p*8
integer*4 x,y,z
character desc*32
end type ObsType
common/Obsc/Obs/ObsTot
integer*4 ObsTot
type (ObsType),allocatable :: Obs(:)
allocate (Obs(ObsTot))
I then want to use this data in a subrourine and in the subroutine repeat the type & common definition bove.
Is this the correct way to go about it as I am getting compile errors,
the first is "This COMMON scalar or array is invalid in this context" on the allocatable line,
or cannot you not use allocatable arrays in subroutines?
David
Link kopiert
5 Antworten
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
COMMON can't be ALLOCATABLE. Follow published examples where an allocatable module array is used.
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Quoting - tim18
COMMON can't be ALLOCATABLE. Follow published examples where an allocatable module array is used.
I have looked in the help - it mentions allocatable but not allocatable module
I am using Visual Fortran 6.0C
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
I don't think DVF 6.0 had any samples of using allocatable arrays. That version is now 11 years old.
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Sorry, the version is 6.6C.
Are there any examples elsewhere?
Are there any examples elsewhere?
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Quoting - davidgraham
Sorry, the version is 6.6C.
Are there any examples elsewhere?
Are there any examples elsewhere?
http://www.stanford.edu/class/me200c/tutorial_90/09_modules.html
or
http://www.sdsc.edu/~tkaiser/f90.html#Passing arrays to subroutines

Antworten
Themen-Optionen
- RSS-Feed abonnieren
- Thema als neu kennzeichnen
- Thema als gelesen kennzeichnen
- Diesen Thema für aktuellen Benutzer floaten
- Lesezeichen
- Abonnieren
- Drucker-Anzeigeseite