I wonder if there is a way of having a global variable in Fortran, which can be stated as some kind of 'protected'. I am thinking of a module A that contains a list of variables. Every other module or subroutine that uses A can use it's variables. If you know what the value of the variable is, you could use parameter to achieve that it can't be overwritten. But what if you have to run code first to determine the variables value? You could not state it as parameter since you need to change it. Is there a way to do something similar but at a specific point at runtime?
相关问题
- CABS(x) function for complex(8)
- Store data and global variables using the Applicat
- Upper bound of random number generator
- Finding number of lines of a data file using comma
- When do Fortran module allocatable arrays go out o
相关文章
- Does gfortran take advantage of DO CONCURRENT?
- Fortran 90 - “Segmentation fault - invalid memory
- javascript setInterval() and Variable Scope
- Reading records from a Fortran binary file in Pyth
- expand a dense matrix
- Unable to use f2py to link large PETSc/SLEPc Fortr
- JS loop variable scope
- How to read comma delimited data file if some data
You could use the
PROTECTED
attribute in a module. It has been introduced with the Fortran 2003 standard. The procedures in the module can change PROTECTED objects, but not procedures in modules or programes that USE your module.Example: