- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi!
Ive made a dummymodule in which ive included a global commonareadefinition through an include-statement.
like this
module Commonarea
INCLUDE MyCommonArea.for'
contains
subroutine dummy
end subroutine dummy
end module Commonarea
The reason for this is to be able to use the commonarea in both *.for and *.f90-files.
In one of the subroutines in my program Im storing the common in an unformatted file. Ive created a huge integerarray and using an equivalencestatement between the first item in the integerarray and the first item in the common to map the memory into my integerarray.
If im using the Use-statement, this doesnt work, but if Im using INCLUDE MyCommonArea.for' instead then it works
Ex:
subroutine test
! Alt 1, not working
USE Commonarea
! Alt 2, working
INCLUDE MyCommonArea.for'
integer inrArr(10000)
equivalence(FirstItemInCommon, intarr(1) )
!StartOfCode
intNo = 1 ! DummyCode
end subroutine test
Can anyone explain the difference or suggest a solution to my problem.
/Martin
Ive made a dummymodule in which ive included a global commonareadefinition through an include-statement.
like this
module Commonarea
INCLUDE MyCommonArea.for'
contains
subroutine dummy
end subroutine dummy
end module Commonarea
The reason for this is to be able to use the commonarea in both *.for and *.f90-files.
In one of the subroutines in my program Im storing the common in an unformatted file. Ive created a huge integerarray and using an equivalencestatement between the first item in the integerarray and the first item in the common to map the memory into my integerarray.
If im using the Use-statement, this doesnt work, but if Im using INCLUDE MyCommonArea.for' instead then it works
Ex:
subroutine test
! Alt 1, not working
USE Commonarea
! Alt 2, working
INCLUDE MyCommonArea.for'
integer inrArr(10000)
equivalence(FirstItemInCommon, intarr(1) )
!StartOfCode
intNo = 1 ! DummyCode
end subroutine test
Can anyone explain the difference or suggest a solution to my problem.
/Martin
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The COMMON you define in the MODULE is not the same as the one that's INCLUDEd directly. Remember that INCLUDE is just source substitution.
Why don't you use the USE statement in your *.for files? It will work fine.
Steve
Why don't you use the USE statement in your *.for files? It will work fine.
Steve
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page